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 6 5978
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: freddy |
last post by:
I would like to load items to a combobox from a text file.
|
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
|
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...
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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...
| |