|
Hi there,
Actually i'm creating question & answers for the student iQ assessment.
I'm using images as a question's. so wnenever image loaded in the form it only can appear for 10 seconds if the user didn't respond within 10 secs it will go to other image likewise for all the images.
So now i can start the timer but i could restart the timer when the 2nd image appear. i can't use any command button to stop or restart. is there any way to do it.
Pls Help me.
Thanx in advance.
|
|
|
|
|
This is pretty simple if you think about it.
You need to write method to get the next question and setup the form. This method then sets up the Timer for 10000 milliseconds (10 seconds). Then enables the Timer.
In the Timer's Timer event, you call that method again, forcing the page to be update with the next question.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave,
Thanx fr ur rply. so basically there is few levels in the test. Each level there are arnd 10 images. For every level i'm using 1 form.
Currently i using the 1 timer only & i set the timer interval as 1000. c the code there
private form1_load()
image1.picture=Loadpicture("C:\images\apple") 'question 1
End Sub.
Private sub form1_keypress(keyascii as integer)
if (keyascii=65) then
image1.picture=Loadpicture("C:\images\bus") 'question 2
if (keyascii=66) then
image1.picture=Loadpicture("C:\images\Cat") 'question 3
if (keyascii=67) then
score=3 'score is a global variable
form2.show 'GOTO LEVEL 2
me.hide
else
score=2
endif
else
score=2
endif
else
image1.picture=Loadpicture("C:\images\apple") 'repeat the question
if (keyascii=65) then
score=1
else
score=0
endif
endif
//if (timer1=10)
image1.picture=Loadpicture("C:\images\bus")
else if (timer1=20)
image1.picture=Loadpicture("C:\images\cat")
endif//
so now i don't know how to set the timer event. According to the code here Let's say if the user answer below 5 secs for the que 1,it will give 15 secs to answer the que 2. which is not correct.
pls me help to solve this.
Thanx.
Regards
|
|
|
|
|
I'm afraid you'll have to scrap ALL of this code. It won't work with a timer at all.
You have to store all of the paths to these images in an array. You'll also have to store the correct answer in that array. You'll proably need a class-level variable to store the current index that's being shown in that array. Then you can setup a timer. Maybe something like this:
Do NOT copy and paste this "code"!!
Public Class Form1
Private currentIndex As Integer
Private flashCards(4,1) As String
Private Sub Form1_Load()
' The first dimension is the filename of the question picture,
' The second dimension is the correct answer for that question.
flashCards(0,0) = "C:\images\apple"
flashCards(0,1) = "A"
flashCards(1,0) = "..."
flashCards(1,1) = "B"
flashCards(2,0) = "..."
flashCards(2,1) = "A"
flashCards(3,0) = "..."
flashCards(3,1) = "C"
' Set the current question number to 0.
currentIndex = 0
' Show the first question...
UpdateQuestionImage()
End Sub
Private Sub Form1_KeyPress(key As Integer)
If Str(key) = flashCards(currentIndex, 1) Then
' The correct answer was found!
currentIndex = currentIndex + 1
UpdateQuestionImage()
End If
End Sub
Private Sub UpdateQuestionImage()
Timer1.Enabled = False
image1.picture=Loadpicture( flashCards(currentIndex, 0) )
Timer1.Interval = 10000
Timer1.Enable = True
End Sub
Private Sub Timer1_Timer()
' Question was not answered in time!
currentIndex = currentIndex + 1
UpdateQuestionImage()
End Sub
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi,
i have a problem in using crystal report in vb.net.
i am using stored procedure with crystal report.
iam assigning discrete value for parameter thro' coding. But only the field name comes in the report without record values when i run the application. when i give manual refresh in the report , the parameter input dialog pops . After giving the input value again the report is generated with the value corresponding to the input.
any one can help me in this regard.
ie with the value given in coding the report should generate .
thanks .
|
|
|
|
|
hi y'all,
the deal is trying to connect to MySQL server, am usin VB 2005 express. when intsallin the server i used my name as the password. accessed it n created a databse and table. then i coded the following just to test it;
Dim MyConstring As String = "DRIVER ={MySQL ODBC 3.51 Driver};" & _
"SERVER = localhost;" & _
"DATABASE = test;" & _
"UID = root;" & _
"PASSWORD =kumoyo;" & _
"OPTION = 3;"
Dim MyConnection As New Odbc.OdbcConnection(MyConstring)
MyConnection.Open()
MsgBox("database opened", MsgBoxStyle.OkOnly, "the 1 skills")
MyConnection.Close()
i assumed my user id is "root", coz when i type slash s i get see user root@local host.
am gettin an error when tryin 2 open the database. what am i doin wrong or what havent i done? i've already installed the odbc.net driver n all. help a brother out here!!!!!!!
|
|
|
|
|
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
70's live! wrote: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Have you installed the driver?
---
b { font-weight: normal; }
|
|
|
|
|
yes i installed the driver n its configured in the odbc administrator. when testin it from odbc administrator test is ok.
|
|
|
|
|
i dunno how to convert vb.net to vb6.....any idea?..
|
|
|
|
|
Why would you want to??
This is going to be a VERY difficult task. VB.NET (the .NET Framework) encapsulates functionality in standard classes that you would have to rewrite from scratch in VB6. There is no conversion tool. Basically, you'd be rewriting the ENTIRE app from scratch.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
LifeIsSad wrote: I need help...pls help....
A better subject line would be helpful to would be helpers. For example: "Convert between VB.NET and VB6" would be a better subject line.
|
|
|
|
|
You probably can't, and why would you want to ? Any non trivial program is likely to use libraries that are not in VB6.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Anyone know how to multi-select from a TreeView with VB.NET 2003 ?
Need help~! Thanks.
|
|
|
|
|
You can't. It's not supported...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi there, you can try to create an array for each node in the treeview you have selected, and just change the back colour or use a different icon to indicate the selected nodes. You should be able to do that with a litle bit of codeing.
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
I found a TreeViewMS control with sample code that support multi-selection of treeview. It is kinda cool.
Thanks anyways.
|
|
|
|
|
|
What's this got to do with VB.NET?? *.LIB files are only good for C/C++ code.
But, since you asked... It's part of the Platform SDK[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I would like to know how to dynamically create a query in an Access database using ADO.Net. I did this using DAO's CreateQueryDef. But I dont want to use DAO in my project. I would like to how this can be achieved in ADO.Net using VB.net or C#.
Thanks for your replies n Awaiting them.
Regards,
Hari.
Hari Prasad...
|
|
|
|
|
|
Hi all...
i'm a bit confuse in VB.NET. Actually i want to upload the webform that i've done in VB.NET to internet. So can we do like that in VB.NET?
Can we also create our own address name (www.....) for the webform?
if yes can someone please help me..
Thanks..
areon25
|
|
|
|
|
These are not programming tasks. What you need to do is set up a server that is visible to the web, and also if you want a www.xxx.com address, you need to register it and set it up to point to the IP address of your online machine. Or you can just get a web hosting company to do it for you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I wanted to know how to populate a form once you have done a search on a record. What I am trying to do is that when I search for a record in the access database, once it finds the record I want it to go to another form where I have textboxes and it should populate the information in that form. The search is on a different form, so I have to switch between forms. If anybody can guide me on the right track I will appreciate it.
|
|
|
|
|
I don't do alot of database interaction but I think I can help you with the interaction between the two forms. You will need to create a Public object reference from Form2 to Form1. Below is a short VB.NET sample that copies the text from a TextBox1 in Form1 to a TextBox2 in Form2. This sample will assume that you have already created two forms named: Form1 and Form2.
In Form2, insert the following code right below the initial class/inherits declaration:
Public Class Form2
Inherits System.Windows.Forms.Form
'Insert this code
Public myObject as Object
Now save the changes to Form2.
One thing you may or may not know is that when Objects are passed to one another, the receiving object does not get a copy of the the passing object, it gets the memory reference to it! That is great news for us. We will now create code to pass Form1's object reference to Form2.
Go to Form1 and it's code view. I will assume that you are showing Form2 by clicking a button of some sort, therefore I will use the sample name Button1.
Private Sub Button1_Click(..) Handles Button1.Click
'sample form2 declaration
Dim pForm2 as new Form2
' here's where the object reference is passed!
' Me is the command for the current form
pForm2.myObject = Me
pForm2.Show
End Sub
The two forms are now linked based on the object reference. Now to illustrate this, create a textbox in each of the forms. (TextBox1 in Form1 and TextBox2 in Form2) Also, add a button to: FORM2.
Form2 will be sending the text from TextBox2 to TextBox1. In Form2's designer mode double click on the newly created Button1 to open the code view and .net will automatically create the click handler sub. In that click handler, insert the following code:
Private Sub Button1_Click(..) Handles Button1.Click
'Note: This button1 code should be in form2 not form1!
'this the code. "Ctype" is casting an unknown object
'to a known object aka. Form1
CType(myObject, Form1).Textbox1.Text = Textbox2.Text
End Sub
There you go! Now run the program and test the code. Form2's textbox should send text to Form1's textbox. You should be able to go from there. Good Luck!
Richard Blythe
|
|
|
|