[Show all top banners]

marulez
Replies to this thread:

More by marulez
What people are reading
Subscribers
Subscribers
[Total Subscribers 1]

janaandolan
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 anybody VB guru
[VIEWED 1614 TIMES]
SAVE! for ease of future access.
Posted on 01-25-06 5:53 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Can anybody help me with Visual Basic?
 
Posted on 01-25-06 7:08 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

you might want to state your problem...
 
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.

 
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.
 
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..
 
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:
 
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.
 
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.
 
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.
 
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... ;)
 
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...
 
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!
 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 60 days
Recommended Popular Threads Controvertial Threads
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
TPS Re-registration case still pending ..
Nas and The Bokas: Coming to a Night Club near you
मन भित्र को पत्रै पत्र!
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
TPS Work Permit/How long your took?
Breathe in. Breathe out.
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
चितवनको होस्टलमा १३ वर्षीया शालिन पोखरेल झुण्डिएको अवस्था - बलात्कार पछि हत्याको शंका - होस्टेलहरु असुरक्षित
शीर्षक जे पनि हुन सक्छ।
Travelling to Nepal - TPS AP- PASSPORT
Nepali doctors future black or white usa ?
Doctors dying suddenly or unexpectedly since the rollout of COVID-19 vaccines
Morning dharahara
Another Song Playing In My Mind
TPS Renewal Reregistration
Nas and The Bokas: Coming to a Night Club near you
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters