i would like ask you how i can generate a multilple choice questions chosen randomly from a list of questions with anwers using functions in visual basic 6.0?
how about you store them on the database? (of course, it sould be.) then each questions will have their own ID's. since they have their own IDs you can use
Int((upperbound - lowerbound + 1) * Rnd + lowerbound) 'where upperbound is the largest number range 'lowerbound is the lowest number range 'Rnd is a VB built in function, and so as Int
to generate random numbers which will be the questions ID numbers. This is only my point of view.
you should do an ADODB connection to a database
for the "how to generate random question"
here's my code: (its from my thesis , but ur free to use it :) )
Set conn = New ADODB.connection prov = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\MAINDB2.mdb" & ";Persist Security Info=False" conn.Open (prov), , , 0 '"<conn string>" ' ***** (step 1) ***** Set rs = conn.Execute("SELECT COUNT(Question) FROM QnE where fldChapter = 9") rCount = rs(0) ' ***** (step 2) ***** Set rs = conn.Execute("SELECT Question FROM QnE where fldChapter = 9") cnt = 1 Dim RRs ReDim RRs(rCount) Do While Not rs.EOF RRs(cnt) = rs(0) cnt = cnt + 1 rs.MoveNext Loop ' ***** (step 3) ***** Randomize currentRR = CLng(Rnd * rCount + 0.5) ID = RRs(currentRR) ' ***** (step 4) ***** sql = "SELECT * FROM QnE WHERE Question= '" & ID & "'" Set rs = conn.Execute(sql) Label1.Caption = ID rs.Close Set rs = Nothing conn.Close Set conn = Nothing
just change the destination field,table and database for the query
and 1 more thing, ID is a dim, and put 1 labelbox on the form
hope you gets something from this ^^
I'm new to python, for my project I need to send mail from python.. I'm getting the following error can someone please help me how to get out of it..
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for ...
Im trying to bind my custom vertical scrollbar to datagridview is this possible.. Please help Thnak you..
i am trying to create a library management system which is supposed to be used to store/keep infp for the library and the library members( book title, author, name and picture for borrower and other stuffs). The app has 6 buttons, delete, save, add,previsous,next, and upload( for upload ...