[VIEWED 1614
TIMES]
|
SAVE! for ease of future access.
|
|
|
marulez
Please log in to subscribe to marulez's postings.
Posted on 01-25-06 5:53
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Can anybody help me with Visual Basic?
|
|
|
|
sujanks
Please log in to subscribe to sujanks's postings.
Posted on 01-25-06 7:08
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
you might want to state your problem...
|
|
|
marulez
Please log in to subscribe to marulez's postings.
Posted on 01-25-06 9:05
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Just new to VB and i have a problem . How can i display different location by clicking on each different command button?(as shown in picture). e.g if I click comedy, on location it displays Aisle 4 if i click drama, on location it displays Kathmandu if i click Sci-Fi, on location it displays ......so on and so far.
|
|
|
zalimSingh
Please log in to subscribe to zalimSingh's postings.
Posted on 01-25-06 9:24
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
i dont know vb and i am not really a programmer, but going by what i learned in my programming classes, i am guessing that vb has a on_click() function. In your on_click function associated with each button, you need to add a call to the object "location_box" to "appear". for example for the comedy button you have on_click() { comedy_location_box.appear(); drama_location_box.disappear(); . . } there is probably a help menu that you can browse to find the exact function/method calls..there is probably a more efficient way too...sorry could not be of more help.
|
|
|
zalimSingh
Please log in to subscribe to zalimSingh's postings.
Posted on 01-25-06 9:28
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
alternatively, for the comedy location on_click, on_click() { location_box.moveToLocation(a,b); //comedy location location_box.displayLabel("Comedy"); //comedy label } for the mystery on_click action, on_click() { location_box.moveToLocation(x,y); //mystery location location_box.displayMysteryLabel("Mystery"); // mystery label } this way, you have fewer lines to code. better design..
|
|
|
thapap
Please log in to subscribe to thapap's postings.
Posted on 01-25-06 9:31
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
i think you already have implemented print function that prints "Aisle 4". Modify this function to take string as an argument. this way you can pass "different messages that you want to display". Private Sub print_screen ( display_message As String ) /* i am sure you have already implemented this based on ur example (O: */ End Sub for each of your push buttons in their private function (O: call print_screen with the "message " as an argument (O: ===================================================== as always what do i knoe (O:
|
|
|
Echoes
Please log in to subscribe to Echoes's postings.
Posted on 01-25-06 9:33
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
It's one of the simplest things to do... First of all, create a Label object in the middle, and lets say call it myLabel1. Then, on the OnClick event of each of the buttons, just assign the label the text you want to see. For example, on the OnClick event of the "Sci-Fi" button, all you'd do is something like this: myLabel1 = "Aisle 4" And do that for every button...with appropriate aisle assigned for each.. Let me know if you need mroe help.
|
|
|
zalimSingh
Please log in to subscribe to zalimSingh's postings.
Posted on 01-25-06 9:39
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
global variables....are those global variables? i learned in an object oriented programming class that global variables are sacrilege...but maybe in VB they are kosher.
|
|
|
Mr. Lonely
Please log in to subscribe to Mr. Lonely's postings.
Posted on 01-25-06 9:47
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Just to add on what Echoes said, To the onClick event of each command button, write this code myLabel.Text = "Aisle 4" where text is the property of Label which sets its display to the value assigned to it.
|
|
|
Echoes
Please log in to subscribe to Echoes's postings.
Posted on 01-25-06 10:15
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
mr. lonely, yes i think you are right... i thought 'Text' was the default property of Label... I guess it's not... thanks for pointing that out... eheh.. obviously, i don't do VB programming... ;)
|
|
|
shree5
Please log in to subscribe to shree5's postings.
Posted on 01-25-06 10:29
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
There are always 101 ways. My style would have been like- I assume you want to do more than just change the label's caption, for example, drawing the same from some datasource (database, xml ...etc). so, for a generic case, lblGenre- the label at the middle of the form i would have packed the displaying part in a sub as, Sub DisplayLabel (captionText) lblGenre.Caption=captionText end sub And captionText would have been, well for me, either a collection or a dictionary object that i have filled in earlier. lets say, collection- colGenre Then, on the click event of the command-button, i would have called the sub with respective values, such as call DisplayLabel(colGenre("comedy")) you might also want to explore the "Tag" property, which all the controls have. "Tag" can hold any string. as such, the easiest method would be to have all the command buttons as a control-array, and on click of them, just assign sub cmdGenre_OnClick(index as interger) lblGenre.Caption=cmdGenre(index).tag end sub there are a lot of ways, its like being a child in a chocolate shop ;) happy vb-ing keep rolling...
|
|
|
nepalean
Please log in to subscribe to nepalean's postings.
Posted on 01-25-06 10:36
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
damn! even I couldt remember a single command of vb. I made a program 5 years ago for undergrad project and now......uff!
|
|