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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cmd button to show 2 text boxes, combo box and check box 3

Status
Not open for further replies.

ixian

Programmer
Jul 13, 2001
128
US
Hey all,

I have a list of 15 text boxes(twice), combo box and check box. Have them all indexed 0 thru 14. Have the 0 visible true while the rest of them false. On click of command button, I wish for the next indexed row of text boxes, combo box and check box to show.

Aaron
 

What about:

-------------------------------------------------------
Private Sub Command1_Click(Index As Integer)
if index<14 then
Command1(Index+1).visible = true
TextBox1(Index+1).visible = true
Combo1(Index+1).visible = true
end if
End Sub
-------------------------------------------------------

Sunaj
 
Sunaj,

I would need 14 command buttons then for the process.
Tried it and it would not do it.
Thanks anyway.

Aaron
 
if what you want is when the have a next line visible when the one before is used then I have what you want because I did that on one of my app.

I don't put the code on the clic evenement of a command put on the &quot;change&quot; on the last control of the line. (here: yourcontrol(index) )

If the last control is not empty then make the next line of control visible...

First create two variables, you'll need them for your index


intindex = Yourcontrol(Index).Index
intindex2 = intindex + 1

Verify is the last control is not empty
If yourcontrol(Index).Text <> &quot;&quot; Then

'Make the next line of controls visible
Combo1(intindex2).Visible = True
Combo2(intindex2).Visible = True
txtbox1(intindex2).Visible = True
txtbox2(intindex2).Visible = True
yourcontrol(intindex2).Visible = True

End If


And without doing a command for each line to make the next line visible, it will do it by itself every time your a the end or your line.
 


Your control is what an user control ????
 
Excuse me, in french a control is anything on your form...

Like: text box, combo box, label, command etc...
 
Im confused then ...so what is the coding going to be like....

Aaron
 
I think what melginger is saying is something like: In the General declarations section, Add a variable named
Code:
Private intindex2 as Long
Then in the code for the command button just add:
Code:
    Combo1(intindex2).Visible = True
    Combo2(intindex2).Visible = True
    txtbox1(intindex2).Visible = True
    txtbox2(intindex2).Visible = True
    yourcontrol(intindex2).Visible = True
    intindex2 = intindex2 + 1

or to make it more advanced, in the xxx_GotFocus(Index as Integer) event of a control, set intindex2 = Index + 1, so that when you click then command button, only the row after where you are would be made visible.

Kevin

 
Kevin or Melginger or other:

Ok ... yourcontrol is what purpose?
I only have tjhese items
a txtDFN -- indexed 0 thru 14
a txtNS --- indexed 0 thru 14
a cboDT --- indexed 0 thru 14
a chkNull - indexed 0 thru 14

so what i would have is (icX is indexed control x = intindex2 )

Option explicit

Private icX as Long

Private sub cmdCNF_click()

txtDFN(icX).visible = true
txtNS(icX).visible = true
cboDT(icX).visible = true
chkNull(icX).visible = true
icX = ixC + 1


Aaron
 
Now how would I make all rows visible = false in one click

this is what i have so far

Private cmdNT_clcick()

txtDFN(icX).visible = false
txtNS(icX).visible = false
cboDT(icX).visible = false
chkNull(icX).visible = false
icx = ?????

Aaron
 
Coo! Wish I could get a star for &quot;yes&quot; :)

25 pages of explanatory notes to MrMoocow and...nothing...
 
strongm,

my philosophy is this ...you help me and it works .. you get star... but that is my way of doing things

Aaron
 
I don't know in what country you are but I was not at work or i was sleeping when you had this post...

For making all your controls (now you know what I mean) visible=false with one clic you have to make a loop

index = 0

while index < 15

txtDFN(index ).visible = false
txtNS(index ).visible = false
cboDT(index ).visible = false
chkNull(index ).visible = false
index = index + 1

wend

Or whatever other loop you want to use...


Thanks Kevin to have help Aaron to understand my explanation when I was not there. You made it work perfectly for what Aaron wanted!

Have a nice day from Québec, Canada
 
melginger,

thanks for the starting of it.

It clears out the rows nicely. But if I wish to start over again with the first part by adding new data rows it starts where the row count started. Any clues???

Aaron Fear is the mind killer!!!!!!
 
I don't understand? Explain to me differently. ( I'm a french one, you know!!!)

 
tounge-in-cheek is wit, humor, joke, (usually british).
 
melginger,

I need the second command to reset the rows of the first command

Here is the code
Here is the command to add more rows of fields:

Private Sub cmdCNF_Click()

txtDFN(icX).Visible = True
txtNS(icX).Visible = True
cboDT(icX).Visible = True
chkNull(icX).Visible = True
icX = icX + 1

End Sub

Here is the cmd the would clear that:

Private Sub cmdCNT_Click()

Index = 0

While Index < 15

txtTN.Text = &quot;&quot;
txtDFN(Index).Text = &quot;&quot;
txtDFN(Index).Visible = False
txtNS(Index).Text = &quot;&quot;
txtNS(Index).Visible = False
cboDT(Index).Text = &quot;Text&quot;
cboDT(Index).Visible = False
chkNull(Index).Value = 0
chkNull(Index).Visible = False
Index = Index + 1

Wend
End Sub

THat clear command clears all the rows that I add thru the 1st command. But I need it to reset to the index value of 0 and not the last number that was use the 1st time.

Aaron

Fear is the mind killer!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top