تقييم الموضوع :
  • 1 أصوات - بمعدل 1
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] ممكن تحويل هذا الكود الى VB NET
#1
Sad 
السلام عليكم

ممكن مساعدة ياشباب Huh

ممكن تحويل هذا الكود الى 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]
الرد }}}
تم الشكر بواسطة:
#2
تفضل هذا هو التحويل للكود :

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
الرد }}}


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [VB.NET] ممكن كود الحدف؟ ahmedhi6 1 1,521 06-01-24, 02:47 AM
آخر رد: HALIM ELEULMA
  ما هو الكود الخاص بـ Enable and Disable to Local Area Connection ؟ PeterGhattas082460 4 3,171 21-12-22, 01:05 PM
آخر رد: Meroo1809
Heart هل ممكن !!!! Adnan1392 1 1,657 06-06-22, 04:06 PM
آخر رد: رمضان272
  [كود] RandomizeArray [الكود الاسطورة وفق رأيي المتواضع] سعود 5 2,859 14-02-21, 10:27 PM
آخر رد: سعود
  [C#.NET] تحويل vb.net إلى #C و العكس 1iambbom 0 2,001 05-06-20, 07:45 PM
آخر رد: 1iambbom
  [كود] كود التجسس علي لوحت المفتيح+ كود طلب الاتصل بل انتر نت+كود تاجيل تنفيز الكود لفتره محمد ايمن 0 1,687 07-03-20, 06:31 PM
آخر رد: محمد ايمن
  [سؤال] ممكن مساعد بعد ازنكم محمد ايمن 7 3,189 03-03-20, 03:46 AM
آخر رد: alsalamoni
  [كود] ممكن مساعده محمد ايمن 0 1,603 14-02-20, 05:47 AM
آخر رد: محمد ايمن
  [كود] طريقة إضافة زر للفورم عن طريق الكود + في حدث معين mohammed moh 20 21,217 06-02-20, 03:00 PM
آخر رد: asemshahen5
Wink [كود] تحويل العمر الى تاريخ ميلاد سعود 2 3,784 04-05-18, 08:22 PM
آخر رد: YousefOkasha

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم