16-02-14, 02:36 PM
تفضل هذا هو التحويل للكود :
Inherits System.Windows.Forms.Form
Private Sub cmdLoad_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLoad.Click
Dim FileName As Object
Dim cdcLoadState As Object
cdcLoadState.ShowOpen()
FileName = cdcLoadState.FileName
If FileName = "" Then
MsgBox("Please load a file.", , "Mem2")
Exit Sub
End If
Call LoadState(FileName)
End Sub
Private Sub cmdSave_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSave.Click
Dim FileName As Object
If FileName = "" Then
MsgBox("Open file", , "Mem2")
Exit Sub
End If
Call SaveState(FileName)
MsgBox("Successfully Saved.", , "Mem2")
End Sub
Public Sub LoadState(ByRef pFile As String)
Dim lblDay4 As Object
Dim lblDay3 As Object
Dim lblDay2 As Object
Dim lblDay As Object
Dim txtDay4 As Object
Dim txtDay3 As Object
Dim txtDay2 As Object
Dim txtDay As Object
Dim FF As Integer
FF = FreeFile
FileOpen(FF, pFile, OpenMode.Binary)
Dim CurVal As Byte
Dim TwoByte As Short
Dim NameData As String
Dim FourByte As Integer
FileGet(FF, TwoByte, 537416 + 1)
txtDay.Text = Val(CStr(TwoByte))
FileGet(FF, TwoByte, 536600 + 1)
txtDay2.Text = Val(CStr(TwoByte))
FileGet(FF, TwoByte, 537240 + 1)
txtDay3.Text = Val(CStr(TwoByte))
FileGet(FF, TwoByte, 537176 + 1)
txtDay4.Text = Val(CStr(TwoByte))
FileClose(FF)
txtDay.Enabled = True
lblDay.Enabled = True
txtDay2.Enabled = True
lblDay2.Enabled = True
txtDay3.Enabled = True
lblDay3.Enabled = True
txtDay4.Enabled = True
lblDay4.Enabled = True
End Sub
Public Sub SaveState(ByRef pFile As String)
Dim txtDay4 As Object
Dim txtDay3 As Object
Dim txtDay2 As Object
Dim txtDay As Object
If pFile = "" Then Exit Sub
Dim FF As Integer
FF = FreeFile
FileOpen(FF, pFile, OpenMode.Binary)
FilePut(FF, CInt(txtDay.Text), 537416 + 1)
FilePut(FF, CInt(txtDay2.Text), 536600 + 1)
FilePut(FF, CInt(txtDay3.Text), 537240 + 1)
FilePut(FF, CInt(txtDay4.Text), 537176 + 1)
FileClose(FF)
End Sub
Inherits System.Windows.Forms.Form
Private Sub cmdLoad_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLoad.Click
Dim FileName As Object
Dim cdcLoadState As Object
cdcLoadState.ShowOpen()
FileName = cdcLoadState.FileName
If FileName = "" Then
MsgBox("Please load a file.", , "Mem2")
Exit Sub
End If
Call LoadState(FileName)
End Sub
Private Sub cmdSave_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSave.Click
Dim FileName As Object
If FileName = "" Then
MsgBox("Open file", , "Mem2")
Exit Sub
End If
Call SaveState(FileName)
MsgBox("Successfully Saved.", , "Mem2")
End Sub
Public Sub LoadState(ByRef pFile As String)
Dim lblDay4 As Object
Dim lblDay3 As Object
Dim lblDay2 As Object
Dim lblDay As Object
Dim txtDay4 As Object
Dim txtDay3 As Object
Dim txtDay2 As Object
Dim txtDay As Object
Dim FF As Integer
FF = FreeFile
FileOpen(FF, pFile, OpenMode.Binary)
Dim CurVal As Byte
Dim TwoByte As Short
Dim NameData As String
Dim FourByte As Integer
FileGet(FF, TwoByte, 537416 + 1)
txtDay.Text = Val(CStr(TwoByte))
FileGet(FF, TwoByte, 536600 + 1)
txtDay2.Text = Val(CStr(TwoByte))
FileGet(FF, TwoByte, 537240 + 1)
txtDay3.Text = Val(CStr(TwoByte))
FileGet(FF, TwoByte, 537176 + 1)
txtDay4.Text = Val(CStr(TwoByte))
FileClose(FF)
txtDay.Enabled = True
lblDay.Enabled = True
txtDay2.Enabled = True
lblDay2.Enabled = True
txtDay3.Enabled = True
lblDay3.Enabled = True
txtDay4.Enabled = True
lblDay4.Enabled = True
End Sub
Public Sub SaveState(ByRef pFile As String)
Dim txtDay4 As Object
Dim txtDay3 As Object
Dim txtDay2 As Object
Dim txtDay As Object
If pFile = "" Then Exit Sub
Dim FF As Integer
FF = FreeFile
FileOpen(FF, pFile, OpenMode.Binary)
FilePut(FF, CInt(txtDay.Text), 537416 + 1)
FilePut(FF, CInt(txtDay2.Text), 536600 + 1)
FilePut(FF, CInt(txtDay3.Text), 537240 + 1)
FilePut(FF, CInt(txtDay4.Text), 537176 + 1)
FileClose(FF)
End Sub
