ledlight

visual studio InitializeComponent and click event

Jun 24th, 2021
746
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.     Public WithEvents Button1 As Button
  3.     Public WithEvents Textbox1 As TextBox
  4.     Public Sub New()
  5.         InitializeComponent()
  6.         RangeSaltSem()
  7.         DreiFingerRegel()
  8.     End Sub
  9.     Sub RangeSaltSem()
  10.         Textbox1 = New TextBox With {
  11.             .Location = New Point(150, 150),
  12.             .Text = paindealers
  13.         }
  14.         Me.Controls.Add(Textbox1)
  15.     End Sub
  16.     Sub DreiFingerRegel()'https://de.wikipedia.org/wiki/Drei-Finger-Regel
  17.         Button1 = New Button With {
  18.             .Size = New Size(40, 40),
  19.             .Location = New Point(30, 30),
  20.             .Text = "Click Me"
  21.         }
  22.         Me.Controls.Add(Button1)
  23.     End Sub
  24.     Public paindealers As String
  25.     Sub Main()
  26.         Application.EnableVisualStyles()
  27.         Application.Run(New Form1())
  28.     End Sub
  29.     Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
  30.         MessageBox.Show(Textbox1.Text)
  31.     End Sub
  32. End Class
RAW Paste Data