Tab controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I'm wondering what is the best way to populate a form that has a tab control
My form has a tab control with multiple tabs. Each tab has many textboxes/datagrids
I'm pulling data from a SQL server database to populate each tab
Is it best to code each tab separate, so data is only pulled over for those fields if that tab is clicked
Or is there a problem with pulling all data over, and coding to fill every field, whether or not the tab is selected?
I've been trying to find an event that triggers the filling of the fields on a tab when that tab is selected...but can't seem to make it populated as soon as the tab is clicked (onclick...enter...gotfocus... <-none of these populate it instantly)
Any advice/suggestions would be appreciated
ambe
 
Hi Amber,

I saw your other code, I think you have to look at binding it is not that
difficult.

Here a sample

\\\
dim cma As CurrencyManager
combobox1.BeginUpdate()
combobox1.DisplayMember = "ident"
textbox1.DataBindings.Clear()
cma = CType(BindingContext(dataset1.Tables(0)), CurrencyManager)
textbox1.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"LastName"))
combobox1.DataSource = dataset1.Tables(0)
combobox1.EndUpdate()
///

I hope this helps,

Cor
 
Hi Amber,
I'm unclear how this answered my question...
Am I missing something?
I'm just looking for advice...what is the best way to populate data when I
have a bunch of tabs on a tab control...is it advisable to populate all
fields at once, or populate them when the tab containing that specific data
is clicked on...

The advice was to use binding and not fill them one by one, and I did give
you an almost complete sample with it.

Cor
 
I guess I just don't understand what it is you are giving me an example of
I'm not having trouble populating my data fields, I'm just curious as to the best way to do it
I'm unclear as to what the combobox is for in your example..
I'm new to vb.net, and I'm not sure if there is an issue to go through the code to populate everything, even if it isn't visible at the moment
ambe
 
Hi Amber

What I try to tell you, that with a lot less instructions mostly than doing
it by hand, you can "bind" the data to the control.

That means that the logic behind the control knows what is the data and what
is the current data.

You do not have to do that yourself.

It is not always easy, especially not when you want special things as
reformating the data, than you need again special events.

In VB.net and C# this is very much better done than in past.

In general using this is very productive.

Here a link for a combobox.
http://msdn.microsoft.com/library/d...ingcomboboxcheckedlistboxorlistboxcontrol.asp


I hope this helps,

Cor
 
Back
Top