473,320 Members | 1,719 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,320 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 5978
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.