Hey guys. I'm currently making a program as a self study guide for my coarses in college. Basically it allows me to add potential multiple choice test questions for any coarse I choose and save it to a file in binary format. And it allows me to test myself by randomly displaying the questions after loading it from file. Well....I'm stuck on figuring out how I can save it.
Basically how I have my structures is like this. I have a number of subjects, which are my coarses in college. Each subject has chapters, which is another structure. And each chapter has questions to that chapter, with possible random answers related to the right answer but will be the wrong answer:
And if I were to save it as a binary file, I haven't the slightest clue on how I'm gonna do it :eek2:
Without having to save multiple files cause I only wanna work with one file that holds everything, I need to be able to save the questions with the random wrong answers with the associated chapters and subjects, and be able to load it from whatever subject and chapter of my choosing, and get the random questions to test myself associated with that chapter and subject. I know its 2 in the morning but I'm stumpt. Maybe I need some sleep to think about it but if anyone has any bright ideas, I would appreciate it. Thanks in advance. :bigyello:
Basically how I have my structures is like this. I have a number of subjects, which are my coarses in college. Each subject has chapters, which is another structure. And each chapter has questions to that chapter, with possible random answers related to the right answer but will be the wrong answer:
vb.net Code:
Private Structure Question_Type <VBFixedString(256)> Dim Answer As String <VBFixedString(256)> Dim Rnd_Answer() As String Public Sub Initialize() ReDim Rnd_Answer(2) End Sub End Structure Private Structure Chapter_Type Dim Question() As Question_Type Dim Number_of_Questions As Integer Public Sub Initialize() ReDim Question(Number_of_Questions) End Sub End Structure Private Structure Subject_Type Dim Chapter() As Chapter_Type Dim Number_Of_Chapters As Integer Public Sub Initialize() ReDim Chapter(Number_Of_Chapters) End Sub End Structure Private Subject(2) As Subject_Type
And if I were to save it as a binary file, I haven't the slightest clue on how I'm gonna do it :eek2:
vb.net Code:
Try Binary_Writer = New BinaryWriter(New FileStream(Application.StartupPath & "\Test.bin", FileMode.Create)) MessageBox.Show(err.Message + "\n Cannot create file.", "", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try 'Subject > Chapter > Questions 'Don't know how I am gonna save this Binary_Writer.Write(???)
Without having to save multiple files cause I only wanna work with one file that holds everything, I need to be able to save the questions with the random wrong answers with the associated chapters and subjects, and be able to load it from whatever subject and chapter of my choosing, and get the random questions to test myself associated with that chapter and subject. I know its 2 in the morning but I'm stumpt. Maybe I need some sleep to think about it but if anyone has any bright ideas, I would appreciate it. Thanks in advance. :bigyello: