473,508 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fill Drop-Downs question

I have a question about technique with regard to filling drop downs.

I have a Winform that has several different tabs and tables associated with
it. In an effort to keep the load time small I would like to not fill the
fields with lookups at form load time. I have a grid on a tab of this form
that has six fields in it that have lookups associated with them. By
lookups I mean that the dropDown in the field is populated by doing a query
on a lookup table. When is the best time to populate (fill) these lookup
fields?

I am thinking that perhaps I could do this when the grid is moved-to like in
an Enter of GotFocus event. For this particular form, the user must
explicitely place himself in edit mode by selecting a button on a toolbar.
Perhaps I could have code (say in the got focus event for the grid) that
says in effect "If the user is in edit mode, run the code that fills the
various lookup fields". I don't really know the best way to deal with this
but to finish off my supposition. If I did the above, I would like for the
code not to run if the fields have already been filled. Perhaps I should
create a global boolean variable for the form called IveAlreadyFilledGridX
and set it to true once the grid has been filled.

If anyone has any suggestions I would appreciate a response.
Nov 20 '05 #1
2 1403
Not sure if this is what you want but I use a technique to fill a combobox
using the Enter event:

Private Sub cboCatalog_Enter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cboCatalog.Enter
Dim objDAO As New DAO(connString) 'my data access class with the ADO
commands in it.
Dim dv As DataView
Try
Cursor.Current = Cursors.WaitCursor
'remove old data
If dsMass.Tables.Contains("dtCatalog") = True Then 'dsMass is a
form level variable
dsMass.Tables.Remove("dtCatalog")
End If

strSQL = "SELECT * FROM Table1"

objDAO.FillTable(dsMass, "dtCatalog", strSQL, DBtype)
dv = (dsMass.Tables("dtCatalog")).DefaultView
dv.Sort = "descr"
With Me.cboCatalog
.DataSource = dv
.DisplayMember = "descr"
.ValueMember = "catalog"
.SelectedIndex = -1
End With
Catch ex As Exception
MessageBox.Show(ex.Message, ex.Source & " - " & ex.TargetSite.Name,
MessageBoxButtons.OK, MessageBoxIcon.Information)
Finally
objDAO = Nothing
Cursor.Current = Cursors.Default
End Try

End Sub
--
Joe Fallon


"Woody Splawn" <wo***@splawns.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I have a question about technique with regard to filling drop downs.

I have a Winform that has several different tabs and tables associated with it. In an effort to keep the load time small I would like to not fill the
fields with lookups at form load time. I have a grid on a tab of this form that has six fields in it that have lookups associated with them. By
lookups I mean that the dropDown in the field is populated by doing a query on a lookup table. When is the best time to populate (fill) these lookup
fields?

I am thinking that perhaps I could do this when the grid is moved-to like in an Enter of GotFocus event. For this particular form, the user must
explicitely place himself in edit mode by selecting a button on a toolbar.
Perhaps I could have code (say in the got focus event for the grid) that
says in effect "If the user is in edit mode, run the code that fills the
various lookup fields". I don't really know the best way to deal with this but to finish off my supposition. If I did the above, I would like for the code not to run if the fields have already been filled. Perhaps I should
create a global boolean variable for the form called IveAlreadyFilledGridX
and set it to true once the grid has been filled.

If anyone has any suggestions I would appreciate a response.

Nov 20 '05 #2
Hi Woody,

Base on my understanding, you have a form and 6 combo boxs on that form.
And you want to populate the combobox at runtime when the according
combobox got focus. There is also a button on the toolbar which indicate if
it is needed to populated. Or you have a datagrid with 6 dropdown on a form

Did I misunderstand your meaning?

Here is simple sample.
.NET Samples - Windows Forms: Data Binding
http://msdn.microsoft.com/library/de...us/cpqstart/ht
ml/cpsmpnetsamples-windowsformsdatabinding.asp

My suggestion is that the solution is based on when the data you want to
query will vary.
If the data is persisted all the time, then you may compile it into a
datafile.
If persisted in the application lifetime, you may load it when the
application is started, if the data is too big you may need to load a part
of them first.
If the query will change every time you change the query value then I think
your solution is good.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
From: "Woody Splawn" <wo***@splawns.com>
Subject: Fill Drop-Downs question
Date: Thu, 9 Oct 2003 14:22:34 -0700
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <OC**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.surewest.net 66.60.158.168
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:145518
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I have a question about technique with regard to filling drop downs.

I have a Winform that has several different tabs and tables associated with
it. In an effort to keep the load time small I would like to not fill the
fields with lookups at form load time. I have a grid on a tab of this form
that has six fields in it that have lookups associated with them. By
lookups I mean that the dropDown in the field is populated by doing a query
on a lookup table. When is the best time to populate (fill) these lookup
fields?

I am thinking that perhaps I could do this when the grid is moved-to like inan Enter of GotFocus event. For this particular form, the user must
explicitely place himself in edit mode by selecting a button on a toolbar.
Perhaps I could have code (say in the got focus event for the grid) that
says in effect "If the user is in edit mode, run the code that fills the
various lookup fields". I don't really know the best way to deal with this
but to finish off my supposition. If I did the above, I would like for the
code not to run if the fields have already been filled. Perhaps I should
create a global boolean variable for the form called IveAlreadyFilledGridX
and set it to true once the grid has been filled.

If anyone has any suggestions I would appreciate a response.


Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8535
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
3
4722
by: andy.standley | last post by:
Hi, We have DB2 SDK V8.2.1 running under redhat ES 3 (taroon update 5) kernel 2.4.21 We have an instance that also contains the tools database for the admin server. We tools have been used to...
1
2034
by: csgraham74 | last post by:
Hi Guys, I am currently building a web aplication in ASP.Net. On the onload event of a page a have a function to populate the many drop down lists on my page. I have one parameter table which...
1
2114
by: MasterChief | last post by:
I have an asp page right now and I want to fill a drop-down list with information like a persons name from an xml file. Once the user picks a person from the drop down list I want it to go back to...
1
7479
by: Steve Richter | last post by:
I have a form. In the Form is a MenuStrip and a FlowLayoutPanel. In the FlowLayoutPanel is a ListBox. The FlowLayoutPanel is set to DockStyle.Fill. The ListBox is set to AnchorStyles.Left |...
3
7329
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
1
2601
by: dellis | last post by:
Problem: My project was initially created without putting passwords in the connection string. When I added the password in the connection string, it disappears when performing a database fill. I...
1
1333
by: Boheim | last post by:
I have two controls on my page: 1) A list box 2)A drop down list I want my users to be able to select from the drop down list and the related data be shown in the list box. For example: lets...
2
1821
by: Fabio Mastria | last post by:
Hi all! In a my simple project I use callback to fill a dropdownlist with xml data returned by a web service, based on a value which is input via another dropdownlist. NOTE: I can't use...
1
3449
by: bytesFTW99 | last post by:
I have been struggling with this for some time can anyone help out? just trying to have 3 dropdown boxes that fill depending on what is selected, then in some cases click a button and have the second...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5052
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.