473,378 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Combobox.FindStringExact--doesn't find text that I KNOW is there.

rdi
I've got a combo-box of the drop-down style (not drop-down-list). The first item is "NHPI-Forms". If I type "NHPI-Forms" into the combo-box that string is supposedly not listed in the combo-box. While if I type "Personal" (which is the THIRD item in the list, it IS found. I'm using "FindStringExact" from the combo-box. WHat could be going on?
TIA

--

RDI

(remove the exclamation from the email address)
'This is performed as part of the initialization of the form
cbxAcctAcctList.Items.Add("NHPI-Forms")
cbxAcctAcctList.Items.Add("NHPI-AutoResponder")
cbxAcctAcctList.Items.Add("Personal")

'This is what happens if I type something into the combobox.
'If I type "NHPI-Forms", the FIRST portion of the IF statement occurs
'if I type "Personal", the SECOND portion of the IF statement occurs
Private Sub cbxAcctAcctList_NewText(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxAcctAcctList.TextChanged
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) Then
BtnAcctRmv.Enabled = True
btnAcctMod.Enabled = True
btnAcctAdd.Enabled = False
Else
BtnAcctRmv.Enabled = False
btnAcctMod.Enabled = False
btnAcctAdd.Enabled = True
End If
End Sub

Nov 20 '05 #1
6 5980
rdi
Never mind. Shortly after hitting send, the answer hit me. Find string returns an integer. If the string is NOT found, it returns -1. If it IS found, it returns the index to it.

The following worked fine.

Private Sub cbxAcctAcctList_NewText(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxAcctAcctList.TextChanged
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) >= 0 Then
BtnAcctRmv.Enabled = True
btnAcctMod.Enabled = True
btnAcctAdd.Enabled = False
Else
BtnAcctRmv.Enabled = False
btnAcctMod.Enabled = False
btnAcctAdd.Enabled = True
End If
End Sub

--

RDI

(remove the exclamation from the email address)

"rdi" <rd**@writeme.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
I've got a combo-box of the drop-down style (not drop-down-list). The first item is "NHPI-Forms". If I type "NHPI-Forms" into the combo-box that string is supposedly not listed in the combo-box. While if I type "Personal" (which is the THIRD item in the list, it IS found. I'm using "FindStringExact" from the combo-box. WHat could be going on?
TIA

--

RDI

(remove the exclamation from the email address)
'This is performed as part of the initialization of the form
cbxAcctAcctList.Items.Add("NHPI-Forms")
cbxAcctAcctList.Items.Add("NHPI-AutoResponder")
cbxAcctAcctList.Items.Add("Personal")

'This is what happens if I type something into the combobox.
'If I type "NHPI-Forms", the FIRST portion of the IF statement occurs
'if I type "Personal", the SECOND portion of the IF statement occurs
Private Sub cbxAcctAcctList_NewText(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxAcctAcctList.TextChanged
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) Then
BtnAcctRmv.Enabled = True
btnAcctMod.Enabled = True
btnAcctAdd.Enabled = False
Else
BtnAcctRmv.Enabled = False
btnAcctMod.Enabled = False
btnAcctAdd.Enabled = True
End If
End Sub

Nov 20 '05 #2
rdi
Never mind. Shortly after hitting send, the answer hit me. Find string returns an integer. If the string is NOT found, it returns -1. If it IS found, it returns the index to it.

The following worked fine.

Private Sub cbxAcctAcctList_NewText(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxAcctAcctList.TextChanged
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) >= 0 Then
BtnAcctRmv.Enabled = True
btnAcctMod.Enabled = True
btnAcctAdd.Enabled = False
Else
BtnAcctRmv.Enabled = False
btnAcctMod.Enabled = False
btnAcctAdd.Enabled = True
End If
End Sub

--

RDI

(remove the exclamation from the email address)

"rdi" <rd**@writeme.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
I've got a combo-box of the drop-down style (not drop-down-list). The first item is "NHPI-Forms". If I type "NHPI-Forms" into the combo-box that string is supposedly not listed in the combo-box. While if I type "Personal" (which is the THIRD item in the list, it IS found. I'm using "FindStringExact" from the combo-box. WHat could be going on?
TIA

--

RDI

(remove the exclamation from the email address)
'This is performed as part of the initialization of the form
cbxAcctAcctList.Items.Add("NHPI-Forms")
cbxAcctAcctList.Items.Add("NHPI-AutoResponder")
cbxAcctAcctList.Items.Add("Personal")

'This is what happens if I type something into the combobox.
'If I type "NHPI-Forms", the FIRST portion of the IF statement occurs
'if I type "Personal", the SECOND portion of the IF statement occurs
Private Sub cbxAcctAcctList_NewText(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxAcctAcctList.TextChanged
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) Then
BtnAcctRmv.Enabled = True
btnAcctMod.Enabled = True
btnAcctAdd.Enabled = False
Else
BtnAcctRmv.Enabled = False
btnAcctMod.Enabled = False
btnAcctAdd.Enabled = True
End If
End Sub

Nov 20 '05 #3
I tried it and it returned 0, which is correct. So your if statement
will return False because 0 is considered False.

'-- Will be false if number is zero
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) Then

'-- You should change it to this:
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) > -1 Then

I've got a combo-box of the drop-down style (not drop-down-list). The
first item is "NHPI-Forms". If I type "NHPI-Forms" into the combo-box
that string is supposedly not listed in the combo-box. While if I type
"Personal" (which is the THIRD item in the list, it IS found. I'm using
"FindStringExact" from the combo-box. WHat could be going on?

TIA

--

RDI

(remove the exclamation from the email address)

'This is performed as part of the initialization of the form
cbxAcctAcctList.Items.Add("NHPI-Forms")
cbxAcctAcctList.Items.Add("NHPI-AutoResponder")
cbxAcctAcctList.Items.Add("Personal")

'This is what happens if I type something into the combobox.
'If I type "NHPI-Forms", the FIRST portion of the IF statement occurs
'if I type "Personal", the SECOND portion of the IF statement occurs
Private Sub cbxAcctAcctList_NewText(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles cbxAcctAcctList.TextChanged
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) Then
BtnAcctRmv.Enabled = True
btnAcctMod.Enabled = True
btnAcctAdd.Enabled = False
Else
BtnAcctRmv.Enabled = False
btnAcctMod.Enabled = False
btnAcctAdd.Enabled = True
End If
End Sub

Nov 20 '05 #4
I tried it and it returned 0, which is correct. So your if statement
will return False because 0 is considered False.

'-- Will be false if number is zero
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) Then

'-- You should change it to this:
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) > -1 Then

I've got a combo-box of the drop-down style (not drop-down-list). The
first item is "NHPI-Forms". If I type "NHPI-Forms" into the combo-box
that string is supposedly not listed in the combo-box. While if I type
"Personal" (which is the THIRD item in the list, it IS found. I'm using
"FindStringExact" from the combo-box. WHat could be going on?

TIA

--

RDI

(remove the exclamation from the email address)

'This is performed as part of the initialization of the form
cbxAcctAcctList.Items.Add("NHPI-Forms")
cbxAcctAcctList.Items.Add("NHPI-AutoResponder")
cbxAcctAcctList.Items.Add("Personal")

'This is what happens if I type something into the combobox.
'If I type "NHPI-Forms", the FIRST portion of the IF statement occurs
'if I type "Personal", the SECOND portion of the IF statement occurs
Private Sub cbxAcctAcctList_NewText(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles cbxAcctAcctList.TextChanged
If cbxAcctAcctList.FindStringExact(cbxAcctAcctList.Te xt) Then
BtnAcctRmv.Enabled = True
btnAcctMod.Enabled = True
btnAcctAdd.Enabled = False
Else
BtnAcctRmv.Enabled = False
btnAcctMod.Enabled = False
btnAcctAdd.Enabled = True
End If
End Sub

Nov 20 '05 #5
"rdi" <rd**@writeme.com> schrieb
Never mind. Shortly after hitting send, the answer hit me. Find
string returns an integer. If the string is NOT found, it returns -1.
If it IS found, it returns the index to it.


Option Strict On helps.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


Nov 20 '05 #6
"rdi" <rd**@writeme.com> schrieb
Never mind. Shortly after hitting send, the answer hit me. Find
string returns an integer. If the string is NOT found, it returns -1.
If it IS found, it returns the index to it.


Option Strict On helps.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


Nov 20 '05 #7

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

Similar topics

1
by: freddy | last post by:
I would like to load items to a combobox from a text file.
1
by: ReidarT | last post by:
I have a databound combobox that opens with the first record in the dataset. I want to have an empty combobox or a text 'Select text'. regards reidarT
2
by: clintonG | last post by:
I only ask this here because it so happens that Windows Search requires filters to enable it to be used to find text in file types such as .aspx, ..cs and so on and is supposed to support doing so...
34
by: priyanka | last post by:
Hi, I was wondering if we could parse or do something in the executable( whose source language was C). How can I use some scripting language like perl/python to find out the information about...
5
by: Piotrekk | last post by:
Hi Having a keyword i need to search HTML file for keyword dismissing all the tags, and checking only plain text. Is there an easy way to do it in C#? Thanks PK
19
by: billa856 | last post by:
Hi, I have to use the table(PRODUCTION) already generated in MS Access in which all fields are of TEXT type.fields like (orderdate,palletno,customercode,itemno,pono,carto n,pcs,totalquantity)Now i...
2
by: vanea | last post by:
Hy. I have a little problem with a comboBox on my form, and i want to ask if anyone could help me. I'm writing a DB application and i am populating my comboBoxes with an ArrayList object and a...
1
by: =?Utf-8?B?Sg==?= | last post by:
Please advise: Find text in Document works sometimes and not others when doing a searh in a 75 page document. If I search for the name Larry, it may bring up 3 names then it freezes. If I search...
3
by: Benjamin Anthony | last post by:
Hi i have a very little knowledge of HTML I am Doing my School Project and need a help. I want to link a combobox to a textbox say if i select a value from the combobox a particular text should...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.