datagridview in tab control

divjoy

Well-known member
Joined
Aug 25, 2013
Messages
109
Programming Experience
1-3
Hi,

I have a vb form with 4 datagridviews within a tab control with 4 tabs, my questions is when should I populate the dgv's ?

Should I place the code in the main form load event or when the user clicks on the specific tab?

I am using vb.net 2010 and sql server 2008

Regards
 

Sterlingard

Member
Joined
Mar 25, 2014
Messages
7
Programming Experience
Beginner
When you insert a dgv with bounded data it will load automatically on form load. you do not have to place any code
 

divjoy

Well-known member
Joined
Aug 25, 2013
Messages
109
Programming Experience
1-3
Hi Sterlingard,

I am not using bounded data, I use vb code to populatethe dgv's.

So was wondering what other programmers do in this scenario.

The main firm would load a little bit faster, and ifthe user did not click on some of the tab controls there would be no need to load the dgv data at all. Thus saving on connections etc...

Would be interested in peoples opinions.

kind regards
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,171
Location
Sydney, Australia
Programming Experience
10+
That's completely up to you and depends on what you're trying to achieve. If there's not much data then it probably doesn't make much difference. If the amount of data is significant then you have to decide what's more important to you: the form displaying in a usable state as quickly as possible or there not being a delay when the user selects a tab. It may well be possible to use a hybrid approach too, i.e. load data in a secondary thread and then display that data when it's required or even while the app is waiting for the user. There's rarely a right answer to how to design a system. It almost always depends on a number of variables and also personal preference.
 
Top Bottom