473,804 Members | 2,249 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 3714
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******** ********@TK2MSF TNGP15.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.Selec tedIndex = ReferenceForm1. data

or

ComboBox1.Selec tedValue = 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
2913
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 the user enter a starting and ending date and only show the records between those dates. The code that I have so far does not work for the dates, but I'm including it anyway so you show me what to change. Thanks so much! :) Here is my code (the...
20
3353
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 speed. I like books with practical exercises, and also with test questions (like cert books) *2*
0
4253
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 Applications and owner of Access Microsystems. Doug can be reached at doug@accessmicrosystems.com. --------------------------------------------------------------------------------
0
1962
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 to use the App_Code directory. I'm having an awful time finding any good examples of this. I've read the examples on http://www.asp.net and various Microsoft webcasts. Most seem very simple and I'm just wondering if I'm on the right track. I'm...
5
3796
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 List<RoleData> GetRoles() { return GetRoles(null, false); }
2
6971
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 attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
4
2197
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 text relating to BBBB ; some more text relating to BBBB I have a form which consists of a combo box control, and text box control. combo box contol is called = comCrime text box control is called = txtProtocol
0
3848
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 for the first time versus when the form is posted (sent to the server), which allows you to program accordingly. · What are user controls and custom controls? Custom controls: A control authored by a user or a third-party software vendor that...
8
3364
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 boxes. So when the criteria is chosen the user selects a click command button and then the results are displayed on another form. I have successfully created the code for the combo boxes on the form.The list boxes are are the problem which are set to...
0
9714
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9173
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6863
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.