اخر المواضيع

الثلاثاء، 19 فبراير 2013


Programming reverse
اقوي اكواد البرمجة
Programming reverse
Powerful programming codes
 

هذا الكود بسيط جداً ولكن مهم لجعل Text Box يكتب رقم لا يكتب نص ويكتب نص ولا يكتب رقم .
أولاً نقوم بإضافة اداة Text Box ونكتب الكود فى الحدث KeyPress
هذا الكود لجعل Text Box يكتب رقم ولا يكتب نص

كود:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Not IsNumeric(e.KeyChar) Then e.Handled = True End If End Sub
هذا الكود لجعل Text Box يكتب نص ولا يكتب رقم

كود:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If IsNumeric(e.KeyChar) Then e.Handled = True End If End Sub



كود لجعل برنامجك تجريبيا



كود:
Public Class Form1 Dim T As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load T = False Dim RegX As Microsoft.Win32.RegistryKey RegX = Microsoft.Win32.Registry.CurrentUser Dim S As String() = RegX.GetSubKeyNames For Each A As String In S If A = "smp3" Then T = True End If Next If T = True Then RegX = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("smp3", True) Dim x As Integer = RegX.GetValue("val") x = x + 1 RegX.SetValue("val", x) If x = 5 Or x > 5 Then MsgBox("لقد انتهت مدتك لاستخدام البرنامج , يرجى الاتصال بفريق الدعم لمعرفة كيفية الشراء") Application.Exit() End If Else RegX = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("smp3") RegX.SetValue("val", 1) End If End Sub End Class


كود اظهار نتيجه حسابيه فى التكست بوكس تلقائيا

كود:
Private Sub ResultTextbox3(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged If TextBox1.Text Is String.Empty Or Not IsNumeric(TextBox1.Text) Then TextBox3.Text = "" Exit Sub End If If TextBox2.Text Is String.Empty Or Not IsNumeric(TextBox2.Text) Then TextBox3.Text = "" Exit Sub End If TextBox3.Text = CType(TextBox1.Text, Integer) * CType(TextBox2.Text, Integer) End Sub


كود وميض الليبل ضع هذا الكود فى التايمر



كود:
If Label1.ForeColor = Color.Red Then Label1.ForeColor = Color.Black Else Label1.ForeColor = Color.Red End If



هذا الكود بسيط جداً ولكن مهم لجعل Text Box يكتب رقم لا يكتب نص ويكتب نص ولا يكتب رقم .
أولاً نقوم بإضافة اداة Text Box ونكتب الكود فى الحدث KeyPress
هذا الكود لجعل Text Box يكتب رقم ولا يكتب نص

كود:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Not IsNumeric(e.KeyChar) Then e.Handled = True End If End Sub
هذا الكود لجعل Text Box يكتب نص ولا يكتب رقم

كود:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If IsNumeric(e.KeyChar) Then e.Handled = True End If End Sub



كود لجعل برنامجك تجريبيا



كود:
Public Class Form1 Dim T As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load T = False Dim RegX As Microsoft.Win32.RegistryKey RegX = Microsoft.Win32.Registry.CurrentUser Dim S As String() = RegX.GetSubKeyNames For Each A As String In S If A = "smp3" Then T = True End If Next If T = True Then RegX = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("smp3", True) Dim x As Integer = RegX.GetValue("val") x = x + 1 RegX.SetValue("val", x) If x = 5 Or x > 5 Then MsgBox("لقد انتهت مدتك لاستخدام البرنامج , يرجى الاتصال بفريق الدعم لمعرفة كيفية الشراء") Application.Exit() End If Else RegX = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("smp3") RegX.SetValue("val", 1) End If End Sub End Class



نص متحرك في Visual Studio
انشئ مشروع جديد
و في الفورم
ضع label
و timer


في الفورم لود ضع
timer1.start()
في التايمر ضع

كود:
If Label1.Left < Me.Width Then Label1.Left += 6 Else Label1.Left = -Label1.Width End If End Sub
End Sub[/CODE]
تقدر تتحكم في السرعة من هذا السطر

كود:
Label1.Left += 6
النتجة



كود لعمل نسخه احتياطيه واسترجعها القاعد اكسس 2003 مربوطه بالفيجوال بيسك

2008

كود:
Dim result = FolderBrowserDialog1.ShowDialog() If result= Windows.Forms.DialogResult.Cancel Then Exit Sub Dim backup_path = (FolderBrowserDialog1.SelectedPath.ToString & "\backup.mdb") Dim orgPath = "MyDB.mdb" System.IO.File.Copy(orgPath, newpath, overwrite:=True)
أما كود الإسترجاع فيكون بإعادة نسخ ملف قاعدة البيانات الى مجلد البرنامج كالأتي:

كود:
Dim filepath = OpenFileDialog1.FileName Dim ProgramDBpath = "MyDB.mdb" System.IO.File.Copy(filepath, ProgramDBpath, overwrite:=True)





معرفة رقم الهارد دسك لاستخدامه في عمل حماية لبرنامجك

كود:
Imports System.Management Imports System.Management.Instrumentation
ثم نقوم بكتابة



الكود التالي في حدث التحميل للنوذج مثلا
كود:
Dim HDinformation As New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia") Dim HD As ManagementObject For Each HD In HDinformation.Get() TextBox1.Text = HD("SerialNumber").ToString() Next


تشغيل الملفات الصوتية متتالية

كود:
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Me.Timer1.Start() If Me.ListBox1.SelectedIndex = 1 Then Me.AxWindowsMediaPlayer1.URL = "الملف " Me.AxWindowsMediaPlayer1.Ctlcontrols.play() End If If Me.ListBox1.SelectedIndex = 2 Then e.AxWindowsMediaPlayer1.URL = "الملف 2" Me.AxWindowsMediaPlayer1.Ctlcontrols.play() End If If Me.ListBox1.SelectedIndex = 3 Then Me.AxWindowsMediaPlayer1.URL = "الملف3" End If If Me.ListBox1.SelectedIndex = 4 Then Me.AxWindowsMediaPlayer1.URL = "الملف4" End If If Me.ListBox1.SelectedIndex = 5 Then Me.AxWindowsMediaPlayer1.URL = "الملف5" End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If Me.ListBox1.SelectedIndex = 5 Then Me.AxWindowsMediaPlayer1.Ctlcontrols.pause() End If If Me.AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1 End If
End Sub



ارسال بريد الكترونى من التطبيق







التعامل مع الاوبن فايل دايلوج والسيف فايل دايلوج

كود فتح الصورة

كود:
كود:
OpenFileDialog1.Filter="jpeg"(*.jpg)|*.jpg" If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox1.Image = System.Drawing.Image.FromFile _ (OpenFileDialog1.FileName) End If




كود نافذة الالوان


If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
textbox.ForeColor = ColorDialog1.Color
End If

((لازم ندرج اداة الالوان حتى يشتغل الكود))



كود حفظ الملف

SaveFileDialog1.Filter = "text files(*.txt)|*.txt"
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName <> "" Then
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
PrintLine(1, T1.Text)
FileClose(1)
End If

((لازم ندرج اداة االحفظ حتى يشتغل الكود))





كود فتح نموذج اخر
كود:
Dim s As New Form2 s.Show()
وممكن هنا نختصر هذا الكود
ونكتب اسم الفورم اللي نبي نربطه (نفتحه)

كود:
form2.show
كود نافذه الخطوط

If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Txetbox.Font = FontDialog1.Font
End If


((لازم ندرج اداة االخطوط حتى يشتغل الكود))






شريط التقدم يتحرك مثلما يتحرك لوجو بداية تشغيل ويندوز

كود:
ProgressBar1.Minimum = 0 ProgressBar1.Maximum = 100 ProgressBar1.Style = ProgressBarStyle.Marquee ProgressBar1.MarqueeAnimationSpeed = 100



كود لتفعيل وتعطيل اداره المهام التاسك مانجر

كود:
Option Explicit On Option Strict On Imports Microsoft.Win32 Public Class Form1 Private Structure RegistryValue Public Path As String Public Value As String End Structure Private rv As RegistryValue = New RegistryValue() Private ReadOnly Property OpenRegistryKeyForWriting() As RegistryKey Get Const Path As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System" Return Registry.CurrentUser.OpenSubKey(Path, True) End Get End Property Private Sub EnableDisableTaskmanager(ByVal Index As String) Dim hKey As RegistryKey = Nothing Try Select Case Index Case "Disabled" hKey = Me.OpenRegistryKeyForWriting() If hKey Is Nothing Then hKey = Registry.CurrentUser.CreateSubKey(rv.Path) hKey.SetValue(rv.Value, 1, RegistryValueKind.DWord) Else hKey = Registry.CurrentUser.CreateSubKey(rv.Path) hKey.SetValue(rv.Value, 1, RegistryValueKind.DWord) End If Case "Enabled" hKey = Me.OpenRegistryKeyForWriting() If hKey IsNot Nothing Then hKey = Registry.CurrentUser.CreateSubKey(rv.Path) hKey.SetValue(rv.Value, 0, RegistryValueKind.DWord) End If End Select Catch ex As Exception MessageBox.Show(ex.Message.ToString(), "Info") Finally If hKey IsNot Nothing Then hKey.Close() End If End Try End Sub Private -- # وصلة ممنوعة 1778 # -- OSVersion() As Boolean If System.Environment.OSVersion.Platform = PlatformID.Win32NT = True Then Return True Else Return False End If End -- # وصلة ممنوعة 1778 # -- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load If Me.OSVersion = False Then MessageBox.Show("This example works only under WinNT or higher…", "Info") Application.Exit() End If Me.CenterToScreen() With Me.rv .Path = "Software\Microsoft\Windows\CurrentVersion\Policies\System" .Value = "DisableTaskMgr" End With End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles Button1.Click Me.EnableDisableTaskmanager("Disabled") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles Button2.Click Me.EnableDisableTaskmanager("Enabled") End Sub End Class
استخدام البروجرس بار

كود:
With ProgressBar1 .Minimum = 1 .Maximum = 100000 .Value = 1 .Step = 1 For i As Integer = .Minimum To .Maximum ‘ Perform one step of the action being tracked. .PerformStep() Next i End With
تحدد الخاصية

* Maximum عدد المراحل ، أو Minimum فهو الرقم الأقل ، الخاصية Value تحدد القيمة الحالية أما الخاصية PerformStep فتقوم بزيادة مرحلة حسب المحدد من خاصية Step .




كود للبحث بين تاريخين..
كود:
Imports System.Data, System.Data.OleDb Public Class Form3 Dim ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source =" & Application.StartupPath & "\DataBase.mdb" Dim Conn As New OleDbConnection(ConStr) Dim DataSet1 As New DataSet Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SQLstr As String = "SELECT * FROM TableName WHERE FieldName Between ‘" & Me.textbox1.Text & "’ and ‘" & Me.textbox2.Text & "’" Conn.Open() Dim DataAdapter1 As New OleDbDataAdapter(SQLstr, Conn) DataAdapter1.Fill(DataSet1, "TableName") Conn.Close() Me.DataGridView1.DataSource = DataSet1 Me.DataGridView1.DataMember = "TableName" If Me.BindingContext(DataSet1, "TableName").Count = 0 Then MsgBox("No Result, Please Try Again ") Exit Sub End If End Sub
مع ضرورة تنسيق التاريخ



كود:
Dim x As String Dim d As Date = CDate(TextBox1.Text) x = Format(d, "dd/MM/yyyy")


لجعل الفورم دوماً في المقدمة

كود:
أسهل كود من A-REG' Me.TopMost = True



لتشغيل ملف فلاش فى برنامج تحتاج لادراج اداه الفلاش AxShockwaveFlash1 على الفورم وعدد 2 بوتون والكود الاتى كامل انسخه وضعه فى الفورم

كود:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click AxShockwaveFlash1.Movie = Application.StartupPath & "\1.swf" AxShockwaveFlash1.Play() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Button1.Text = "تشغيل" Button2.Text = "ايقاف" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ‘جرب اى واحده من دول الاتنين شغالين وتمام ‘ AxShockwaveFlash1.StopPlay() AxShockwaveFlash1.Stop() End Sub End Class


كود لتوليد ارقام عشوائيه اضف تايمر واربعه تكست بوكس وضع الكود التالى فى الفورم تحت التايمر تك وانظر للنتيجه حدد الانترفال للتايمر كما تحب

كود:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim R As New Random Randomize() Dim Number As Integer Number = R.Next(20, 105) ‘ MsgBox(Number) TextBox1.Text = Number TextBox2.Text = Number TextBox3.Text = Number TextBox4.Text = Number End Sub



كود لتوليد لون كل ثانيه اضف تايمر واضبط الانترفال الى 1000 اى ثانيه واحده وضع الكود التالى فى الفورم وانظر للنتيجه

كود:
Public Class Form1 Dim n As Integer Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.BackColor = System.Drawing.ColorTranslator.FromOle(QBColor(n)) n = n + 1 If n = 15 Then n = 0 End Sub End Class
الأستخدام: لألتقاط صورة من الشاشة

الأدوات: button عدد 3 +CheckBox1+PictureBox1


Public Class Form1
كود:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim b As Bitmap = New Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height) Dim g As Graphics = Graphics.FromImage(b) Dim s As Size = New Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height) If CheckBox1.Checked Then Me.Hide() Dim t As DateTime = Now.AddSeconds(1) Do : Application.DoEvents() Loop Until Now.Second >= t.Second g.CopyFromScreen(0, 0, 0, 0, s, CopyPixelOperation.SourceCopy) Me.Show() t = Nothing Else g.CopyFromScreen(0, 0, 0, 0, s, CopyPixelOperation.SourceCopy) End If PictureBox1.Image = b g.Dispose() b = Nothing End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim saveDlg As SaveFileDialog = New SaveFileDialog Dim dlgResult As DialogResult = New DialogResult saveDlg.Filter = "JPEG Files (*.jpg)|*.jpg" saveDlg.Title = "Select the file to save the image too." dlgResult = saveDlg.ShowDialog If dlgResult = Windows.Forms.DialogResult.OK Then PictureBox1.Image.Save(saveDlg.FileName) End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Button1.Text = "ألتقاط" Button1.Text = "حفظ الصورة" Button3.Text = "إنهاء" CheckBox1.Text = "إخفاء" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class



الأستخدام :تدريج اللون داخل الفورم بشكل متحرك




الأدوات:timer عدد 1+PictuerBoxعدد 1

كود:
Imports System.Drawing.Drawing2D Public Class Form1 Private M_M As Single = 0 Private M_D As Single = 0.1 Private Sub PictureBox1_Paint(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PaintEventArgs) Handles _ PictureBox1.Paint Dim LB As New LinearGradientBrush(New Point(0, 0), New Point _ (Me.ClientSize.Width, 0), Color.Green, Color.Yellow) Dim CB As New ColorBlend CB.Colors = New Color() {Color.Green, Color.YellowGreen, Color.Yellow} CB.Positions = New Single() {0, M_M, 1} LB.InterpolationColors = CB e.Graphics.FillRectangle(LB, Me.ClientRectangle) LB.Dispose() M_M += M_D If (M_M > 1) OrElse (M_M < 0) Then M_D = -M_D End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick PictureBox1.Invalidate() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Enabled = True End Sub End Class



الأستخدام:الأتصال بقاعدة البيانات وعرضه على الفورم


كود:
Public Class Form1 Inherits System.Windows.Forms.Form Dim WithEvents bmb As BindingManagerBase Dim Myds As New DataSet() Dim InfoManager As CurrencyManager
سنعمل أتصال بقاعدة البيانات بأستخدام الأكسيس
سنطبق على قاعدة فيه جدول فيه عمودين
تحتاج إلى تكست بوكس عدد2
زر تحريك يمين وزريسار
أقرأ الكود بشكل جيد وضع محل كل أسم الجدول العمود الأول العمود الثاني أسه بالأنكليزي


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New OleDb.OleDbConnection()
Dim sql As String
sql = "select
العمود الأول,العمود الأول from اسم الجول"
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=
مسار القاعدة;Persist Security Info=False"
Dim daPerson As New OleDb.OleDbDataAdapter(sql, con)
daPerson.Fill(Myds, "mm1")
t1.DataBindings.Add("Text", Myds, "
أسم الجدول.العمود الأول")
t2.DataBindings.Add("Text", Myds, "
سم الجدول.العمود الثاني")
bmb = Me.BindingContext(Myds, "
أسم الجدول")
bmb.Position = bmb.Count
bmb.Position = 0
Button1.Text = ">>"
Button1.Text = "<<"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
تحريك يمين
bmb.Position -= 1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
تحريك يسار
bmb.Position += 1
End Sub
End Class






الأستخدام :لتغير لون الزر عند مرور الفأرة عليه

الأدوات :button


كود:
Public Class Form1 Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover Button1.BackColor = Color.DodgerBlue End Sub End Class




الأستخدام:الزر الخفي

الأدوات :3button+1label


Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "
هل أعجبتك الأكواد "
Button1.Text = "
لا"
Button3.Text = "
لا"
Button2.Text = "
نعم"
End Sub

Private Sub Button3_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.MouseHover
Button3.Visible = False
Button1.Visible = True
End Sub
Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover
Button3.Visible = True
Button1.Visible = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox("
مع تحيات المهندس المدني:محمد إياد شرارة" & Chr(13) & "تمتعوا بالمزيد قريبا للتواصل xxxxxxxxxx", MsgBoxStyle.MsgBoxRight, "وداعا")
End
End Sub
End Class
xxxxxxxxx = بالإميلك










الأستخدام :كود نسخ

الأدوات: button عدد2+textbox

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "
نسخ"
Button2.Text = "
مسح"
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text <> "" Then
Button2.Enabled = True
Button1.Enabled = True
Else
Button2.Enabled = False
Button1.Enabled = False
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
End Sub
هذا فقط كود النسخ
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Clipboard.Clear()
Clipboard.SetText(TextBox1.Text)
End Sub
End Class









الأستخدام :مؤثر جميل على النص

الأدوات :timer عدد 2 +label1

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "
المهندس المدني :محمد إياد شرارة" ‘النص
Timer1.Enabled = True
Timer1.Interval = 500 ‘
سرعة التبدل
Me.BackColor = Color.Black
Timer2.Enabled = True
Timer2.Interval = 500 ‘
سرعة التحرك
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Label1.ForeColor = Color.MediumSeaGreen Then
Label1.ForeColor = Color.Violet
Else
Label1.ForeColor = Color.MediumSeaGreen
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If Label1.Location.X = 74 And Label1.Location.Y = 97 Then
Label1.Left = Label1.Left + 10
ElseIf Label1.Location.X = 84 And Label1.Location.Y = 97 Then
Label1.Left = Label1.Left - 10
End If

End Sub

End Class









الأستخدام :تحريك الكلمات في عنوان الفورم والتكست



الأدوات :TIMER1+TEXTBOX1

كود:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 75 TextBox1.Text = "Guten Tag! Wie ght’s Ihnen? Ich hoffe Ihnen alles Gutes!" TextBox1.Text = Space(50) & TextBox1.Text End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick TextBox1.Text = Mid(TextBox1.Text, 2) TextBox1.Text = TextBox1.Text Me.Text = TextBox1.Text End Sub End Class





الكود:لأظهار تحية عند فتح البرنامج حسب الوقت

كود:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If TimeOfDay <= "11:30 AM" Then MsgBox("Good Morning YourNameHere!") Exit Sub End If If TimeOfDay > "11:30 AM" And TimeOfDay < "5:00 PM" Then MsgBox("Good Afternoon YourNameHere!") Exit Sub End If If TimeOfDay > "5:00 PM" Then MsgBox("Good Evening YourNameHere!") Exit Sub End If If TimeOfDay >= "12:01 AM" Then MsgBox("Good Morning YourNameHere!") Exit Sub End If End Sub End Class


 

ليست هناك تعليقات:

إرسال تعليق