Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays? Any suggestions?

Status
Not open for further replies.

RandomEvil

Programmer
Dec 11, 2004
4
US
I would like to construct an Array that will cut something like this code down. I had tried but wasn't able to get it to work so used IF THEN.


If Option1(O) = True Then
txtStartpnt.Text = 100
End If
If Option1(1) = True Then
txtStartpnt.Text = 123
End If
If Option1(2) = True Then
txtStartpnt.Text = 135
End If
If Option1(3) = True Then
txtStartpnt.Text = 150
End If

Does anyone have a good formula to programming ARRAYS?

Thanks for any help

R E
 
CubeE101

Sorry mate there is a text1.lbound and a text1.ubound
in vb6 if the control is an array
 
scratch this comment...
>>(and even then, it would be Text1.Text.UBound, etc...)
I was thinking about UCase and LCase ;-)

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
AEtherson said:
CubeE101

Sorry mate there is a text1.lbound and a text1.ubound
in vb6 if the control is an array

Yeah, you're right... (my bad)

I would still use the For Each method in case there are gaps in the indexes though... Such As you delete one of the indexes and forget to reindex the rest of them...

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
First off I would like to thank all of your replies and different options. It is clear to me that I should be more specific and I will try to so in the future.

RandomEvil
 
thanks...sorry..i forgot something about the code..
dim i as byte
for i = text1.lbound to text1.ubound
if text1(i) = "" then
msgbox "blah..blah..blah.."
next i
end if
else
"im going to use save command if the textbox are not blank.."
end sub

it seems that it only considers the last textbox not to be blank..if other textbox are blank and the last textbox is not..it will still save..so i want that all textbox should be filled up before it will consider saiving to the database..thanks again
 
I *think* this is what you are looking for...

Code:
Dim T As TextBox
Dim FoundBlank as Boolean
For Each T In Text1
  If T = "" Then FoundBlank = True
Next
If Not FoundBlank Then
  'Save Code here...
End If

this loops through the TextBoxes and sets FoundBlank to true if it finds a blank value...

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top