473,386 Members | 1,708 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,386 software developers and data experts.

weird but serious combo box problem

i need help with a combo box and this same code works on my first tab with a
combo box. The error or problem i have is this code causes an index out of
range error when i run it on my second combo box:
(errored code) Select Case ComboBox2.text
Case Is ="Execute Program"
'code to execute program here
Case Is ="Other Command that executes code at a certain time"

' code below the same as above except that it works
But not my first(this code works fine):
Select Case ComboBox.text

i tryed changeing my selected index so it would always have a zero or first
item in the index subscript and checking index properties but i still get
this error and i put my selected index in a combo box just to see if thats
not the error and it is not the index is equal to -1.

any help as to why this happens because i dont know why but every time i get
this error

thanks for any help that can be offered,
jeffery the planner

Jan 8 '08 #1
6 1853
Using the debugger, what is the value of ComboBox2.text at the Select Case
statement? What are the values of the ComboBox2.Items list? Does the
ComboBox2.text show up in your list of cases for the Select statement?
"jeffery" wrote:
i need help with a combo box and this same code works on my first tab with a
combo box. The error or problem i have is this code causes an index out of
range error when i run it on my second combo box:
(errored code) Select Case ComboBox2.text
Case Is ="Execute Program"
'code to execute program here
Case Is ="Other Command that executes code at a certain time"

' code below the same as above except that it works
But not my first(this code works fine):
Select Case ComboBox.text

i tryed changeing my selected index so it would always have a zero or first
item in the index subscript and checking index properties but i still get
this error and i put my selected index in a combo box just to see if thats
not the error and it is not the index is equal to -1.

any help as to why this happens because i dont know why but every time i get
this error

thanks for any help that can be offered,
jeffery the planner
Jan 8 '08 #2
i do have the strings in my select case in my combo box too and the index and
text i select are correct too. i tryed using Combobox.items.item property and
selecteditem and they both caused errors for me.

"Family Tree Mike" wrote:
Using the debugger, what is the value of ComboBox2.text at the Select Case
statement? What are the values of the ComboBox2.Items list? Does the
ComboBox2.text show up in your list of cases for the Select statement?
"jeffery" wrote:
i need help with a combo box and this same code works on my first tab with a
combo box. The error or problem i have is this code causes an index out of
range error when i run it on my second combo box:
(errored code) Select Case ComboBox2.text
Case Is ="Execute Program"
'code to execute program here
Case Is ="Other Command that executes code at a certain time"

' code below the same as above except that it works
But not my first(this code works fine):
Select Case ComboBox.text

i tryed changeing my selected index so it would always have a zero or first
item in the index subscript and checking index properties but i still get
this error and i put my selected index in a combo box just to see if thats
not the error and it is not the index is equal to -1.

any help as to why this happens because i dont know why but every time i get
this error

thanks for any help that can be offered,
jeffery the planner
Jan 8 '08 #3
Can you post a complete code example that fails?

"jeffman" wrote:
i do have the strings in my select case in my combo box too and the index and
text i select are correct too. i tryed using Combobox.items.item property and
selecteditem and they both caused errors for me.

"Family Tree Mike" wrote:
Using the debugger, what is the value of ComboBox2.text at the Select Case
statement? What are the values of the ComboBox2.Items list? Does the
ComboBox2.text show up in your list of cases for the Select statement?
"jeffery" wrote:
i need help with a combo box and this same code works on my first tab with a
combo box. The error or problem i have is this code causes an index out of
range error when i run it on my second combo box:
(errored code) Select Case ComboBox2.text
Case Is ="Execute Program"
'code to execute program here
Case Is ="Other Command that executes code at a certain time"
>
' code below the same as above except that it works
But not my first(this code works fine):
Select Case ComboBox.text
>
i tryed changeing my selected index so it would always have a zero or first
item in the index subscript and checking index properties but i still get
this error and i put my selected index in a combo box just to see if thats
not the error and it is not the index is equal to -1.
>
any help as to why this happens because i dont know why but every time i get
this error
>
thanks for any help that can be offered,
jeffery the planner
>
Jan 8 '08 #4
this is the code that causes errors:
Select Case ComboBox2.text

Case Is ="Execute Program"

'commands to select program to execute
'code brevity because i dont have the time to give full code
ListCommands.items.Add("Execute Program")
'other list box adds here like adding the time to execute the task
'use a open file dialog box to select a program to execute
ListPrograms.items.add(OpenFileDialog1.FileName)
'add code here to lock the timed event as i said i the comment above i have
code abrevity or in this line i just tell what other code would go here.

Case Is ="Auto-Type into Program"

'Other cases for other commmands here

ComboBox2.text equals the correct value i selected from combobox2 at
runtime. Example: I select ""execute program"" (for emphais so someone will
pay attention) from the combo box and it is supposed to execute a program.
But the selectedindex is correct for combo box2 when my selected index
changed event fires. for instance execute program would be first in combo
box2 so the selectedindex would be 0 for execute program. can someone help me
because this is all i know and i am not a professional programmer either and
not a beginner programmer either but i dont know everything but i know a lot
of programming tasks.

this is all i know if you know anything else i can add please tell me i have
run out of things to tell you and i think my problem could have already been
answered by now.

can anyone provide an answer it is just so fustrating programming with weird
errors like this becuase the text property shouldnt cause a error because it
should come up with a string value of a item i select out of items i add
statically and shouldnt be changed if i dont tell it to.

iam sorry but this sounds like something simple the error it gives me is:
"index out of range index is less then zero or greater then list count - 1" i
tryed what you said about checking the index to see if its correct and that
and incorrect text or blank text are not problems either so iam guessing or
thinking it is a simple problem.

thanks for any help because this is so fustrating , but i still cant figure
it out

jeffery

"Family Tree Mike" wrote:
Can you post a complete code example that fails?

"jeffman" wrote:
i do have the strings in my select case in my combo box too and the index and
text i select are correct too. i tryed using Combobox.items.item property and
selecteditem and they both caused errors for me.

"Family Tree Mike" wrote:
Using the debugger, what is the value of ComboBox2.text at the Select Case
statement? What are the values of the ComboBox2.Items list? Does the
ComboBox2.text show up in your list of cases for the Select statement?
>
>
"jeffery" wrote:
>
i need help with a combo box and this same code works on my first tab with a
combo box. The error or problem i have is this code causes an index out of
range error when i run it on my second combo box:
(errored code) Select Case ComboBox2.text
Case Is ="Execute Program"
'code to execute program here
Case Is ="Other Command that executes code at a certain time"

' code below the same as above except that it works
But not my first(this code works fine):
Select Case ComboBox.text

i tryed changeing my selected index so it would always have a zero or first
item in the index subscript and checking index properties but i still get
this error and i put my selected index in a combo box just to see if thats
not the error and it is not the index is equal to -1.

any help as to why this happens because i dont know why but every time i get
this error

thanks for any help that can be offered,
jeffery the planner
Jan 9 '08 #5
jeffery wrote:
this is the code that causes errors:
Get it to tell you what the value is before you try using it:

MsgBox(ComboBox2.text)
Select Case ComboBox2.text
Case "Execute Program"
<snip>

And make sure to use Option Strict On, which will catch a lot of errors.

Andrew
Jan 9 '08 #6
the message box didnt help i still have a error and i have another group i
posted to and i am wanting to go professional and iam not spamming just so
you all can know. the other group said i should try the collections of the
combobox. i dont know what properties they were wanting me to use to do this
the only propertys i would know how to use is most of the propertys in the
items class. i heard about other propertys about dealing with collection in
list and combboxs in msdn help but dont know how to use them but dont know
how to use them.
"Andrew Morton" wrote:
jeffery wrote:
this is the code that causes errors:

Get it to tell you what the value is before you try using it:

MsgBox(ComboBox2.text)
Select Case ComboBox2.text
Case "Execute Program"
<snip>

And make sure to use Option Strict On, which will catch a lot of errors.

Andrew
Jan 10 '08 #7

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

Similar topics

0
by: Andrew Mayo | last post by:
This problem was discovered with MSDE2000 SP2 and under WinXP SP2. We are unsure whether it is more widespread as it has only been seen on one machine to date. The problem is related to name...
4
by: Andromeda | last post by:
I have two tables... one contains all the loan officer information (name/address/phone/email/etc) the other is a NH license table which lists has 3 columns - txtLOName, dtDateHireSent,...
6
by: MX1 | last post by:
OK, here's one that's driving me nuts. Three tables. They are... Master Table JobRef Reference Table ToolRef Reference Table I've got a form for...
1
by: Ian Lane .enizin.net> | last post by:
Hello, I am having a strange issue between my Test environment and my Production environment. The problem is my site runs beautifully on Test and almost beautifully on Production. They are both...
2
by: Ken Powers | last post by:
Hello everyone, I'm getting a strange error when I try to bind a combo box to a Dataset. Here's my code! Private Sub Get_Data() Try Dim sqlcmd = New SqlCommand("Select * from Utility order...
0
by: Ken Powers | last post by:
Hello everyone, Sorry about the repost, my second VB.NET App is done with the exception of this error. I'm getting a strange error when I try to bind a combo box to a Dataset. Here's my code! ...
1
by: ricolee99 | last post by:
Hi everyone, I have a .net application called "InteropService". InteropService consumes a com component called 'B'. 'B' consumes a third party dll. Everything seems to work fine. However,...
14
by: WStoreyII | last post by:
the following code is supposed to read a whole line upto a new line char from a file. however it does not work. it is producing weird results. please help. I had error checking in there for...
2
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.