This is a pretty basic issue but for some reason i just can't read a boolean value from a binary file.
Here's the code i'm using
if i look at the file it displays the two words in the password feilds but no 1 or 0.
Here's the code i'm using
Imports System.IO
Public Class Form1
Structure userdata
Dim ispass As Boolean
Dim password1 As String
Dim password2 As String
End Structure
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim setpass As userdata
Dim mybinwrite As New BinaryWriter(File.Open("myset.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite))
setpass.ispass = 1
setpass.password1 = TextBox1.Text
setpass.password2 = TextBox2.Text
mybinwrite.Write(setpass.ispass)
mybinwrite.Write(setpass.password1)
mybinwrite.Write(setpass.password2)
mybinwrite.Close()
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim mybinread As New BinaryReader(File.Open("myset.bin", FileMode.Open, FileAccess.Read))
Dim readpass As userdata
readpass.ispass = mybinread.ReadBoolean
mybinread.Close()
If readpass.ispass = 1 Then
MsgBox("wahooooooo")
End If
If readpass.ispass = 0 Then
MsgBox("enter password")
End If
End Sub
End Class
if i look at the file it displays the two words in the password feilds but no 1 or 0.