473,507 Members | 8,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET: Using String to compare with the Combo Box

Hi...

Say i have this string call "data" in Form1, this string contains number "5"
value....

how do i pass this string to the Form2 and compare with the combo box
items...

The combo box DropDownStyle is set to DropDownList...
which means when i pass, the SelectedIndex must be subtract or add by 1 to
get the correct items to display...

The Listbox items contain:
One, Two, Three, Four and Five...

How to i actually pass this string to Form2 and Form2 will compare the
number 5 with the items and display Five instead in the combo box
correctly..

Thanks

toytoy -- forum member
http://www.visual-basic-data-mining.net/forum
Nov 21 '05 #1
2 3702
ooh....."It is the combo box items contain" not "Listbox items contain" in
the previous thread..

To give a clearer picture:

Form2 will be open only after i click on another button in Form1..

data "5" is already in the string and is waiting to be passed to Form2....

The "5" will be comapre accordingly with the items in one of the combobox in
Form2.....

then the combox box in Form2 will display accordingly to the compare
items...In this case which is the "Five" in the items instead of "5"..

That means the combo box will be able to check the items with the string and
display accordingly...

Thanks

--
toytoy - forum member
http://www.visual-basic-data-mining.net/forum
"http://www.visual-basic-data-mining.net/forum" <si******@gmail.com> wrote
in message news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi...

Say i have this string call "data" in Form1, this string contains number "5" value....

how do i pass this string to the Form2 and compare with the combo box
items...

The combo box DropDownStyle is set to DropDownList...
which means when i pass, the SelectedIndex must be subtract or add by 1 to get the correct items to display...

The Listbox items contain:
One, Two, Three, Four and Five...

How to i actually pass this string to Form2 and Form2 will compare the
number 5 with the items and display Five instead in the combo box
correctly..

Thanks

toytoy -- forum member
http://www.visual-basic-data-mining.net/forum

Nov 21 '05 #2
Form2 can have a reference to Form1. In Form2 declarations:

Private ReferenceForm1 as Form1

If the data variable in Form1 is declared as Public or Friend, you can get
its value from Form2:

ReferenceForm1.data

If data=5, and the ComboBox or ListBox has the SelectedIndex of 5 for
"Five", or the SelectedValue of "5" for "Five", then when you set that
property, "Five" will be displayed.

In the Form2 Load event:

ComboBox1.SelectedIndex = ReferenceForm1.data

or

ComboBox1.SelectedValue = ReferenceForm1.data

In the first case, data would be numeric, in the second, a string. The
SelectedValue property is determined by the ValueMember property of the
ComboBox. It points to a Fieldname. The DisplayMember property also points
to a FieldName, and defines which column is shown in the ComboBox.

www.charlesfarriersoftware.com


"http://www.visual-basic-data-mining.net/" wrote:
Hi...

Say i have this string call "data" in Form1, this string contains number "5"
value....

how do i pass this string to the Form2 and compare with the combo box
items...

The combo box DropDownStyle is set to DropDownList...
which means when i pass, the SelectedIndex must be subtract or add by 1 to
get the correct items to display...

The Listbox items contain:
One, Two, Three, Four and Five...

How to i actually pass this string to Form2 and Form2 will compare the
number 5 with the items and display Five instead in the combo box
correctly..

Thanks

toytoy -- forum member
http://www.visual-basic-data-mining.net/forum

Nov 21 '05 #3

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

Similar topics

3
2892
by: Afton | last post by:
I would like to make a form that filters a report by Supervisor and by starting and ending date. I have the supervisors in a combo box, and that works. However, I do not know how to code to let...
20
3292
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
0
4199
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
0
1952
by: dm1608 | last post by:
Hello -- I'm trying to rewrite a few simple ASP pages that I have to use ASP.NET 2.0. One of the nice things I see that I can do now is separate my Business Logic layer and Data Access Layer...
5
3766
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
2
6925
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
4
2182
by: CCLeasing | last post by:
I have a text file which consists of lines of data. Each line has units of data seperated by semicolons, like so. AAAA ; some text relating to AAAA ; some more text relating to AAAA BBBB ; some...
0
3821
by: shamirza | last post by:
· What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested...
8
3342
by: hollinshead | last post by:
Hi there i have bit of an issue. i haver this database that is purely used for searching records under certain criteria. This criteria is chosen by the user on a form using list boxes and combo...
0
7314
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,...
1
7030
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...
0
7482
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
5623
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,...
0
4702
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
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
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 ...
1
758
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.