473,563 Members | 2,662 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 IveAlreadyFille dGridX
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 1407
Not sure if this is what you want but I use a technique to fill a combobox
using the Enter event:

Private Sub cboCatalog_Ente r(ByVal sender As Object, ByVal e As
System.EventArg s) Handles cboCatalog.Ente r
Dim objDAO As New DAO(connString) 'my data access class with the ADO
commands in it.
Dim dv As DataView
Try
Cursor.Current = Cursors.WaitCur sor
'remove old data
If dsMass.Tables.C ontains("dtCata log") = True Then 'dsMass is a
form level variable
dsMass.Tables.R emove("dtCatalo g")
End If

strSQL = "SELECT * FROM Table1"

objDAO.FillTabl e(dsMass, "dtCatalog" , strSQL, DBtype)
dv = (dsMass.Tables( "dtCatalog")).D efaultView
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.N ame,
MessageBoxButto ns.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******** ******@TK2MSFTN GP09.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 IveAlreadyFille dGridX
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-windowsformsdat abinding.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.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.sure west.net 66.60.158.168
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:145518
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 IveAlreadyFille dGridX
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
8556
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 column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one...
3
4728
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 set up some tasks that have run well for a few months. I addes some more tasks and then a week or two later went to use the task center to see what...
1
2040
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 stores all the values e.g. Title,Type,Status,Property,Occupation. I am using a sql string and then populationg my drop down list
1
2118
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 the xml file and load the information about the person into textboxes. Does anybody have an example for something like this in asp?
1
7495
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 | AnchorStyles.Right I am able to verify that the FlowLayoutPanel grows in size as the form
3
7340
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 document selected (my application uses the BusinessObjects Java Web Services SDK) The 2nd list is dependent on the 1st, while the 3rd list is...
1
2609
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 have stepped through the code in debug and the connection string is correct up til the Fill command. Once the fill executes, the password disappears from...
1
1338
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 say the data in the combo box were the names of various students. I want the users to select a student name and then their classes be listed in the...
2
1827
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 ajax/atlas. Using javascript and callback all works... but if I press a button or any event that raise a postback, the dropdownlist that I fill gets...
1
3453
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 set of 3 dropdown boxes be filled with the same values. thank you <head> <SCRIPT LANGUAGE="JavaScript" type="text/javascript"> var...
0
7877
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7631
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6238
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5479
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5204
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2077
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
912
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.