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 5982
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: 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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |