اريد تحويل هذا الكود الى نموذج حسب خصائص كل اداة
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.CompilerServices
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Drawing
Imports System.Runtime.CompilerServices
Imports System.Windows.Forms
Public Class Form118
Inherits Form
' Methods
Public Sub New()
AddHandler MyBase.KeyPress, New KeyPressEventHandler(AddressOf Me.frmSkins3_KeyPress)
Form118.__ENCAddToList(Me)
Me.ErrorProvider1 = New ErrorProvider
Me.InitializeComponent()
End Sub
<DebuggerNonUserCode()> _
Private Shared Sub __ENCAddToList(ByVal value As Object)
Dim list As List(Of WeakReference) = Form118.__ENCList
SyncLock list
If (Form118.__ENCList.Count = Form118.__ENCList.Capacity) Then
Dim index As Integer = 0
Dim num3 As Integer = (Form118.__ENCList.Count - 1)
Dim i As Integer = 0
Do While (i <= num3)
Dim reference As WeakReference = Form118.__ENCList.Item(i)
If reference.IsAlive Then
If (i <> index) Then
Form118.__ENCList.Item(index) = Form118.__ENCList.Item(i)
End If
index += 1
End If
i += 1
Loop
Form118.__ENCList.RemoveRange(index, (Form118.__ENCList.Count - index))
Form118.__ENCList.Capacity = Form118.__ENCList.Count
End If
Form118.__ENCList.Add(New WeakReference(RuntimeHelpers.GetObjectValue(value)))
End SyncLock
End Sub
Private Sub Button7_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.ErrorProvider1.Dispose()
If ((Conversions.ToDouble(Me.TextBox1.Text) = 1212) And (Conversions.ToDouble(Me.TextBox9.Text) = 1213)) Then
Module1.pth = ("Provider=Microsoft.Jet.OLEDB.4.0;;Jet OLEDB:Database Password=12181218;Data Source=" & Application.StartupPath & "\nakell.mdb")
Dim form As New Form7
Me.Hide()
form.ShowDialog()
Me.Close()
Else
If Not (Conversions.ToDouble(Me.TextBox1.Text) = 1212) Then
Me.ErrorProvider1.SetError(Me.TextBox1, ChrW(1582) & ChrW(1591) & ChrW(1571) & " " & ChrW(1601) & ChrW(1610) & " " & ChrW(1575) & ChrW(1587) & ChrW(1605) & " " & ChrW(1575) & ChrW(1604) & ChrW(1605) & ChrW(1587) & ChrW(1578) & ChrW(1582) & ChrW(1583) & ChrW(1605) & " ")
End If
If Not (Conversions.ToDouble(Me.TextBox9.Text) = 1213) Then
Me.ErrorProvider1.SetError(Me.TextBox9, ChrW(1582) & ChrW(1591) & ChrW(1571) & " " & ChrW(1601) & ChrW(1610) & " " & ChrW(1603) & ChrW(1604) & ChrW(1605) & ChrW(1577) & " " & ChrW(1575) & ChrW(1604) & ChrW(1605) & ChrW(1585) & ChrW(1608) & ChrW(1585))
End If
End If
End Sub
Private Sub Button8_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.Close()
End Sub
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If (disposing AndAlso (Not Me.components Is Nothing)) Then
Me.components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
Private Sub frmSkins3_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If (Strings.Asc(e.KeyChar) = 13) Then
SendKeys.Send("{tab}")
End If
End Sub
<DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New Container
Dim manager As New ComponentResourceManager(GetType(Form118))
Me.TextBox1 = New TextBox
Me.Label13 = New Label
Me.TextBox9 = New TextBox
Me.Label5 = New Label
Me.Button7 = New Button
Me.Button8 = New Button
Me.ErrorProvider2 = New ErrorProvider(Me.components)
DirectCast(Me.ErrorProvider2, ISupportInitialize).BeginInit()
Me.SuspendLayout()
Me.TextBox1.BackColor = Color.White
Me.TextBox1.Font = New Font("Tahoma", 9.75!, FontStyle.Regular, GraphicsUnit.Point, &HB2)
Dim point2 As New Point(5, 9)
Me.TextBox1.Location = point2
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.RightToLeft = RightToLeft.Yes
Dim size2 As New Size(&HE9, &H17)
Me.TextBox1.Size = size2
Me.TextBox1.TabIndex = 0
Me.Label13.AutoSize = True
Me.Label13.Font = New Font("Tahoma", 9.75!, FontStyle.Regular, GraphicsUnit.Point, &HB2)
Me.Label13.ForeColor = Color.Black
point2 = New Point(&HF9, &H2E)
Me.Label13.Location = point2
Me.Label13.Name = "Label13"
Me.Label13.RightToLeft = RightToLeft.Yes
size2 = New Size(&H40, &H10)
Me.Label13.Size = size2
Me.Label13.TabIndex = 5
Me.Label13.Text = ChrW(1603) & ChrW(1604) & ChrW(1605) & ChrW(1577) & " " & ChrW(1575) & ChrW(1604) & ChrW(1587) & ChrW(1585)
Me.TextBox9.BackColor = Color.White
Me.TextBox9.Font = New Font("Tahoma", 9.75!, FontStyle.Regular, GraphicsUnit.Point, &HB2)
point2 = New Point(4, &H2A)
Me.TextBox9.Location = point2
Me.TextBox9.Name = "TextBox9"
Me.TextBox9.PasswordChar = "#"c
Me.TextBox9.RightToLeft = RightToLeft.Yes
size2 = New Size(&HE9, &H17)
Me.TextBox9.Size = size2
Me.TextBox9.TabIndex = 1
Me.Label5.AutoSize = True
Me.Label5.Font = New Font("Tahoma", 9.75!, FontStyle.Regular, GraphicsUnit.Point, &HB2)
Me.Label5.ForeColor = Color.Black
point2 = New Point(&HF4, 11)
Me.Label5.Location = point2
Me.Label5.Name = "Label5"
Me.Label5.RightToLeft = RightToLeft.Yes
size2 = New Size(&H5F, &H10)
Me.Label5.Size = size2
Me.Label5.TabIndex = 4
Me.Label5.Text = ChrW(1575) & ChrW(1587) & ChrW(1605) & " " & ChrW(1575) & ChrW(1604) & ChrW(1605) & ChrW(1587) & ChrW(1578) & ChrW(1582) & ChrW(1583) & ChrW(1605)
Me.Label5.TextAlign = ContentAlignment.MiddleRight
Me.Button7.ImeMode = ImeMode.NoControl
point2 = New Point(&H5B, &H4B)
Me.Button7.Location = point2
Me.Button7.Name = "Button7"
size2 = New Size(80, &H17)
Me.Button7.Size = size2
Me.Button7.TabIndex = 2
Me.Button7.Text = ChrW(1605) & ChrW(1608) & ChrW(1575) & ChrW(1601) & ChrW(1602)
Me.Button7.UseVisualStyleBackColor = True
Me.Button8.ImeMode = ImeMode.NoControl
point2 = New Point(5, &H4B)
Me.Button8.Location = point2
Me.Button8.Name = "Button8"
size2 = New Size(80, &H17)
Me.Button8.Size = size2
Me.Button8.TabIndex = 3
Me.Button8.Text = ChrW(1573) & ChrW(1604) & ChrW(1594) & ChrW(1575) & ChrW(1569) & " " & ChrW(1575) & ChrW(1604) & ChrW(1571) & ChrW(1605) & ChrW(1585)
Me.Button8.UseVisualStyleBackColor = True
Me.ErrorProvider2.ContainerControl = Me
size2 = New Size(5, 13)
Me.AutoScaleBaseSize = size2
Me.BackColor = Color.FromArgb(&HD8, &HE4, &HF8)
size2 = New Size(&H169, &H6A)
Me.ClientSize = size2
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label13)
Me.Controls.Add(Me.TextBox9)
Me.Controls.Add(Me.Label5)
Me.FormBorderStyle = FormBorderStyle.FixedSingle
Me.Icon = DirectCast(manager.GetObject("$this.Icon"), Icon)
Me.KeyPreview = True
Me.MaximizeBox = False
Me.Name = "Form118"
Me.RightToLeft = RightToLeft.Yes
Me.StartPosition = FormStartPosition.CenterScreen
Me.Text = ChrW(1578) & ChrW(1587) & ChrW(1580) & ChrW(1610) & ChrW(1604) & " " & ChrW(1575) & ChrW(1604) & ChrW(1583) & ChrW(1582) & ChrW(1608) & ChrW(1604)
DirectCast(Me.ErrorProvider2, ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Private Sub PasswordTextBox_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
If (e.KeyCode = Keys.Return) Then
Me.Button7_Click(RuntimeHelpers.GetObjectValue(sender), e)
End If
End Sub
' Properties
Friend Overridable Property Button7 As Button
<DebuggerNonUserCode()> _
Get
Return Me._Button7
End Get
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode()> _
Set(ByVal WithEventsValue As Button)
Dim handler As EventHandler = New EventHandler(AddressOf Me.Button7_Click)
If (Not Me._Button7 Is Nothing) Then
RemoveHandler Me._Button7.Click, handler
End If
Me._Button7 = WithEventsValue
If (Not Me._Button7 Is Nothing) Then
AddHandler Me._Button7.Click, handler
End If
End Set
End Property
Friend Overridable Property Button8 As Button
<DebuggerNonUserCode()> _
Get
Return Me._Button8
End Get
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode()> _
Set(ByVal WithEventsValue As Button)
Dim handler As EventHandler = New EventHandler(AddressOf Me.Button8_Click)
If (Not Me._Button8 Is Nothing) Then
RemoveHandler Me._Button8.Click, handler
End If
Me._Button8 = WithEventsValue
If (Not Me._Button8 Is Nothing) Then
AddHandler Me._Button8.Click, handler
End If
End Set
End Property
Friend Overridable Property ErrorProvider2 As ErrorProvider
<DebuggerNonUserCode()> _
Get
Return Me._ErrorProvider2
End Get
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode()> _
Set(ByVal WithEventsValue As ErrorProvider)
Me._ErrorProvider2 = WithEventsValue
End Set
End Property
Friend Overridable Property Label13 As Label
<DebuggerNonUserCode()> _
Get
Return Me._Label13
End Get
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode()> _
Set(ByVal WithEventsValue As Label)
Me._Label13 = WithEventsValue
End Set
End Property
Friend Overridable Property Label5 As Label
<DebuggerNonUserCode()> _
Get
Return Me._Label5
End Get
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode()> _
Set(ByVal WithEventsValue As Label)
Me._Label5 = WithEventsValue
End Set
End Property
Friend Overridable Property TextBox1 As TextBox
<DebuggerNonUserCode()> _
Get
Return Me._TextBox1
End Get
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode()> _
Set(ByVal WithEventsValue As TextBox)
Me._TextBox1 = WithEventsValue
End Set
End Property
Friend Overridable Property TextBox9 As TextBox
<DebuggerNonUserCode()> _
Get
Return Me._TextBox9
End Get
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode()> _
Set(ByVal WithEventsValue As TextBox)
Dim handler As KeyEventHandler = New KeyEventHandler(AddressOf Me.PasswordTextBox_KeyDown)
If (Not Me._TextBox9 Is Nothing) Then
RemoveHandler Me._TextBox9.KeyDown, handler
End If
Me._TextBox9 = WithEventsValue
If (Not Me._TextBox9 Is Nothing) Then
AddHandler Me._TextBox9.KeyDown, handler
End If
End Set
End Property
' Fields
'Private Shared __ENCList As List(Of WeakReference) = New List(Of WeakReference)
'<AccessedThroughProperty("Button7")> _
Private _Button7 As Button
<AccessedThroughProperty("Button8")> _
Private _Button8 As Button
<AccessedThroughProperty("ErrorProvider2")> _
Private _ErrorProvider2 As ErrorProvider
<AccessedThroughProperty("Label13")> _
Private _Label13 As Label
<AccessedThroughProperty("Label5")> _
Private _Label5 As Label
<AccessedThroughProperty("TextBox1")> _
Private _TextBox1 As TextBox
<AccessedThroughProperty("TextBox9")> _
Private _TextBox9 As TextBox
Private components As IContainer
Private ErrorProvider1 As ErrorProvider
End Class
ِ