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 am developing a simple job card creator application with VB.net 2012, using Access 2010 as database.
The code I have generated to write data from a datagridview to the database table is successfully saving the data, but with an error "Parameter @name has no default value". The ...
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...