Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18013
Number of posts: 55386

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Needing a little help please Posted by rphillips on 24 Feb 2006 at 10:21 PM
how would i code a procedure for the SelectedIndexChange event of the combo box that occurs when the user selects a week number. This procedure should display the daily attendance values for the week indicated by the combo box. In other words it should display the array values for that week in the text boxes.

Okay I have an array of (3, 4)
the form has a combo box with 1-4(weeks)
Monday:(textboxes)
Tuesday:(textboxes)
Wednesday:(textboxes)
Thursday:(textboxes)
Friday:(textboxes)

Buttons are:
save week, show average, clear and exit

I really appreciate anyone's help that can help me!!!
Report
Re: Needing a little help please Posted by BitByBit_Thor on 25 Feb 2006 at 4:32 AM
: how would i code a procedure for the SelectedIndexChange event of the combo box that occurs when the user selects a week number. This procedure should display the daily attendance values for the week indicated by the combo box. In other words it should display the array values for that week in the text boxes.
:
: Okay I have an array of (3, 4)
: the form has a combo box with 1-4(weeks)
: Monday:(textboxes)
: Tuesday:(textboxes)
: Wednesday:(textboxes)
: Thursday:(textboxes)
: Friday:(textboxes)
:
: Buttons are:
: save week, show average, clear and exit
:
: I really appreciate anyone's help that can help me!!!
:

Put this code, or a modified version of it, in the event for the combobox:
Dim nIndex As Integer

'Get the value selected from the combobox
' for usage as an index for the array
nIndex = Val(ComboBox.List(ComboBox.ListIndex)) - 1

Text1.Text = TheArray(nIndex, 0)
Text2.Text = TheArray(nIndex, 1)
Text3.Text = TheArray(nIndex, 2)
Text4.Text = TheArray(nIndex, 3)
Text5.Text = TheArray(nIndex, 4)


This should about do it. If you put this code in the Click event of the combobox then, as soon as the user selects a value, the five textboxes will display the value of the array.

If you want the user to be able to change the array value, you should code the Change event for the textboxes to update the array.

Best Regards,
Richard

Report
combo.list(BitByBit_Thor) Posted by rphillips on 25 Feb 2006 at 12:29 PM
I have a question for ya. The reply you sent had this:

nIndex = Val(ComboBox.List(ComboBox.ListIndex)) - 1
I am using VB.net

my combo box is:
cboWeek.

when i use that code it does give me the selection for list.
what would I use??

Thanks,
Rob
Report
Re: combo.list(BitByBit_Thor) Posted by DrMarten on 25 Feb 2006 at 1:00 PM
This message was edited by DrMarten at 2006-2-25 13:1:43

: I have a question for ya. The reply you sent had this:
:
: nIndex = Val(ComboBox.List(ComboBox.ListIndex)) - 1
: I am using VB.net
:
: my combo box is:
: cboWeek.
:
: when i use that code it does give me the selection for list.
: what would I use??
:
: Thanks,
: Rob


==========================

Rob,

A hint for VB.Net

If you call any object like a comboBox by a customName then use that customName before the dot.

Eg. In your case>>

nIndex = Val(cboWeek.List(cboWeek.ListIndex)) - 1

Hope this helps?



Regards,

Dr M.

Report
Re: combo.list(BitByBit_Thor) Posted by rphillips on 25 Feb 2006 at 10:55 PM
No not really.
What I need is when I select the combo box, I need to be able to
bring up the data that is saved.

Report
Re: combo.list(BitByBit_Thor) Posted by rphillips on 26 Feb 2006 at 2:08 AM
You have the application running.

Lets say the user has week two selected in the combo box. They want to see the data that is saved from week one. I need to have a select change for the combo box that will allow the user to see the data that is saved from the previous weeks.





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.