السلام عليكم
ممكن مساعدة ياشباب
ممكن تحويل هذا الكود الى VB NET شاكرا لكم
Private Sub cmdLoad_Click()
' Show the Open Dialog
cdcLoadState.ShowOpen
FileName = cdcLoadState.FileName
' If no file was selected then exit the sub
If FileName = "" Then
MsgBox "Please load a file.", , "Mem2"
Exit Sub
End If
' Load the file
Call LoadState(FileName)
End Sub
Private Sub cmdSave_Click()
If FileName = "" Then
MsgBox "Open file", , "Mem2"
Exit Sub
End If
Call SaveState(FileName)
MsgBox "Successfully Saved.", , "Mem2"
End Sub
Public Sub LoadState(pFile As String)
' Create a variable used in locating the next available filenumber
Dim FF As Long
' The variable FF is equal to the next available file number
FF = FreeFile
Open pFile For Binary As #FF
' For reading one byte data
Dim CurVal As Byte
' For reading two byte data
Dim TwoByte As Integer
' For reading names
Dim NameData As String
' For reading four byte data
Dim FourByte As Long
' Load the Day
Get #FF, 537416 + 1, TwoByte
txtDay.Text = Val(TwoByte)
Get #FF, 536600 + 1, TwoByte
txtDay2.Text = Val(TwoByte)
Get #FF, 537240 + 1, TwoByte
txtDay3.Text = Val(TwoByte)
Get #FF, 537176 + 1, TwoByte
txtDay4.Text = Val(TwoByte)
Close #FF
' Re-enable controls
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(pFile As String)
If pFile = "" Then Exit Sub
Dim FF As Long
FF = FreeFile()
Open pFile For Binary As FF
' Save the Day
Put #FF, 537416 + 1, CLng(txtDay.Text)
' Save the Day
Put #FF, 536600 + 1, CLng(txtDay2.Text)
' Save the Day
Put #FF, 537240 + 1, CLng(txtDay3.Text)
' Save the Day
Put #FF, 537176 + 1, CLng(txtDay4.Text)
Close #FF
End Sub
[/align]
ممكن مساعدة ياشباب
ممكن تحويل هذا الكود الى VB NET شاكرا لكم
Private Sub cmdLoad_Click()
' Show the Open Dialog
cdcLoadState.ShowOpen
FileName = cdcLoadState.FileName
' If no file was selected then exit the sub
If FileName = "" Then
MsgBox "Please load a file.", , "Mem2"
Exit Sub
End If
' Load the file
Call LoadState(FileName)
End Sub
Private Sub cmdSave_Click()
If FileName = "" Then
MsgBox "Open file", , "Mem2"
Exit Sub
End If
Call SaveState(FileName)
MsgBox "Successfully Saved.", , "Mem2"
End Sub
Public Sub LoadState(pFile As String)
' Create a variable used in locating the next available filenumber
Dim FF As Long
' The variable FF is equal to the next available file number
FF = FreeFile
Open pFile For Binary As #FF
' For reading one byte data
Dim CurVal As Byte
' For reading two byte data
Dim TwoByte As Integer
' For reading names
Dim NameData As String
' For reading four byte data
Dim FourByte As Long
' Load the Day
Get #FF, 537416 + 1, TwoByte
txtDay.Text = Val(TwoByte)
Get #FF, 536600 + 1, TwoByte
txtDay2.Text = Val(TwoByte)
Get #FF, 537240 + 1, TwoByte
txtDay3.Text = Val(TwoByte)
Get #FF, 537176 + 1, TwoByte
txtDay4.Text = Val(TwoByte)
Close #FF
' Re-enable controls
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(pFile As String)
If pFile = "" Then Exit Sub
Dim FF As Long
FF = FreeFile()
Open pFile For Binary As FF
' Save the Day
Put #FF, 537416 + 1, CLng(txtDay.Text)
' Save the Day
Put #FF, 536600 + 1, CLng(txtDay2.Text)
' Save the Day
Put #FF, 537240 + 1, CLng(txtDay3.Text)
' Save the Day
Put #FF, 537176 + 1, CLng(txtDay4.Text)
Close #FF
End Sub
[/align]