Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-19-2008, 12:46 AM
iTTaleem iTTaleem is offline
Newbie
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0
iTTaleem is on a distinguished road
Unhappy make a label box in vb : help

Hi Every one ,
on monday i have to submit my assignment i need ur help in this regard

make a label box in vb

one label box

and only one

and one text button

okay

so, when the user clicks on the next button

a question should display in that label box

he/she click again, the second question displays

so on..

15 questions should display

my teacher she showed some thing like this but that doesnt work .

Quote:
Private Sub cmdNext_Click()
Dim intQuestion As Integer
Dim intQ1 As Integer
Dim intQ2 As Integer

intQuestion = intQuestion + 1

If intQuestion = intQ1 Then
lblQuestion.Caption = "Which country has the most people?"
ElseIf intQuestion = intQ2 Then
lblQuestion.Caption = "What is the biggest, ocean or a lake?"
End If



End Sub
can any one tell me how to do so ? i will be thank full to him / her
waiting
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-19-2008, 12:52 PM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

Ok so here is my solution. IGNORE THE TEACHER'S CODE, takes too long!

What you need is to use an array of 15 'slots'. So declare one array of 15 and one integer. Now whenever the user clicks the integer will be increased by + 1 (like in the example of your teacher) and that integer will be the 'slot' number reference.

If you don't know how to do anything specific please post back here. I will help you with it. But it is your homework and you should at least show me some efforts for me to help you (i.e. show me some beginning code, and not your teacher's)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-20-2008, 03:33 AM
iTTaleem iTTaleem is offline
Newbie
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0
iTTaleem is on a distinguished road
Default

well i tried this my self but didnt worked
Quote:
Dim intQ1 As Integer
Dim intQ2 As Integer

those to must have a value
declare it on your next button


on your form_load event put this


intQ1 = 1
intQ2 = 2
intQ3 = 3
(and so )
private_Sub cmdNext_click()


if intQuestion=1 then
lblQuestion.Caption = "Which country has the most people?"
ElseIf intQuestion = intQ2 Then
lblQuestion.Caption = "What is the biggest, ocean or a lake?"
(and so on)


(lastly)
intQuestion = intQuestion + 1
end if
end sub
can u plz give me a code or any other tip that work i will be thank full to u
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-20-2008, 05:06 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

Well.... As I told you use an array

as I told you, you need to use an array. To make an array you should use something like this:

Code:
Dim QuestionArray(1 To 5) As String
Then declare a normal integer

Then declare ever 'slot' of the array with the question, like this:

Code:
QuestionArray(1) = "Question One"
QuestionArray(2) = "Question Two"
etc...

Then with every click increase that integer, for example I used a variable i like this:

Code:
i = i + 1
and then finally write the question in the label like this:

Code:
Label1.Caption = (QuestionArray(i))
Now As you have 15 questions, if you continue clicking the button for more than 15 times it will show an error, you can fix that with a conditional statement
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB 6.0: Tutorial, How to Make Glass2K!! TcM VB Tutorials 12 09-28-2008 12:53 PM
VB 6.0: Tutorial, How to make a GIF in your application TcM VB Tutorials 17 07-01-2008 04:26 PM
How Do I Make A Notepad In VB 2008? Cetol Visual Basic Programming 5 01-26-2008 03:26 AM
What Sort Of Things Did You Make When You Started VB? Skel Visual Basic Programming 1 11-06-2007 02:47 PM
How to make Dumplings ahsan16 The Lounge 2 01-11-2007 11:55 PM


All times are GMT -5. The time now is 06:25 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads