Advertisement
Guest User

Untitled

a guest
Feb 25th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.75 KB | None | 0 0
  1. Public Class TableGenerator
  2.  
  3.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4.         Try
  5.             If CInt(TextBox2.Text) > 1000 Then TextBox2.Text = "1000"
  6.         Catch ex As Exception
  7.             Try
  8.                 TextBox2.Text = (CInt(TextBox1.Text) + 1).ToString
  9.             Catch exx As Exception
  10.                 TextBox1.Text = "1"
  11.                 TextBox2.Text = "2"
  12.             End Try
  13.         End Try
  14.  
  15.         If RadioButton1.Checked = True Then
  16.             lua()
  17.         ElseIf RadioButton2.Checked = True Then
  18.             luavorhanden()
  19.         End If
  20.     End Sub
  21.  
  22.     Public Sub lua()
  23.  
  24.         Try
  25.             RichTextBox1.Text = ""
  26.             If Not CInt(TextBox1.Text) = Nothing And Not CInt(TextBox2.Text) = Nothing Then
  27.                 If CInt(TextBox1.Text) >= 0 And (CInt(TextBox2.Text) >= CInt(TextBox1.Text)) Then
  28.                     Dim curText As String = TextBox3.Text.Replace(" ", "_")
  29.                     If CheckBox1.Checked = True Then
  30.                         RichTextBox1.Text = "local " & TextBox3.Text & " = { "
  31.                     Else
  32.                         RichTextBox1.Text = TextBox3.Text & " = { "
  33.                     End If
  34.                     Dim standartText As String = TextBox4.Text
  35.                     For i As Integer = CInt(TextBox1.Text) To CInt(TextBox2.Text) Step 1
  36.                         RichTextBox1.Text = RichTextBox1.Text & vbNewLine & "[" & i.ToString & "] = " & standartText
  37.                         If i = CInt(TextBox2.Text) Then
  38.                             RichTextBox1.Text = RichTextBox1.Text & vbNewLine
  39.                         Else
  40.                             RichTextBox1.Text = RichTextBox1.Text & ","
  41.                         End If
  42.                     Next
  43.                     RichTextBox1.Text = RichTextBox1.Text & "}"
  44.                 Else
  45.                     MsgBox("Falsche EIngabe bei den Zahlenwerten!")
  46.                 End If
  47.             End If
  48.         Catch ex As Exception
  49.             MsgBox("Bitte überprüfen sie ihre Eingaben!")
  50.         End Try
  51.  
  52.  
  53.     End Sub
  54.  
  55.     Public Sub luavorhanden()
  56.         Try
  57.             RichTextBox1.Text = ""
  58.             If Not CInt(TextBox1.Text) = Nothing And Not CInt(TextBox2.Text) = Nothing Then
  59.                 If (CInt(TextBox1.Text) >= 0) And (CInt(TextBox2.Text) >= (CInt(TextBox1.Text))) Then
  60.                     Dim curText As String = TextBox3.Text.Replace(" ", "_")
  61.                     Dim standartText As String = TextBox4.Text
  62.                     For i As Integer = CInt(TextBox1.Text) To CInt(TextBox2.Text) Step 1
  63.                         RichTextBox1.Text = RichTextBox1.Text & vbNewLine & TextBox3.Text & "[" & i.ToString & "] = " & standartText
  64.                     Next
  65.                 Else
  66.                     MsgBox("Falsche EIngabe bei den Zahlenwerten!")
  67.                 End If
  68.             End If
  69.         Catch ex As Exception
  70.             MsgBox("Bitte überprüfen sie ihre Eingaben!")
  71.         End Try
  72.  
  73.  
  74.     End Sub
  75.  
  76.     Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
  77.         If RadioButton1.Checked = True Then
  78.             CheckBox1.Enabled = True
  79.         Else
  80.             CheckBox1.Enabled = False
  81.             CheckBox1.Checked = False
  82.         End If
  83.     End Sub
  84.  
  85.     Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click
  86.         Me.Close()
  87.     End Sub
  88.  
  89.     Private Sub Label5_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.MouseHover
  90.         Label5.BackColor = Color.FromArgb(255, 190, 190, 190)
  91.     End Sub
  92.  
  93.     Private Sub Label5_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.MouseLeave
  94.         Label5.BackColor = Color.FromKnownColor(KnownColor.Gainsboro)
  95.     End Sub
  96.  
  97.     Dim StartingPosition As Point
  98.     Dim DragPosition As Point
  99.  
  100.     Public Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
  101.         If e.Button = Windows.Forms.MouseButtons.Left Then
  102.             StartingPosition = Me.Location
  103.             DragPosition = Me.PointToScreen(New Point(e.X, e.Y))
  104.         End If
  105.     End Sub
  106.  
  107.     Public Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
  108.         If e.Button = Windows.Forms.MouseButtons.Left Then
  109.             Dim CursorPosition As Point = Me.PointToScreen(New Point(e.X, e.Y))
  110.             Me.Location = New Point(StartingPosition.X + CursorPosition.X - DragPosition.X, _
  111.               StartingPosition.Y + CursorPosition.Y - DragPosition.Y)
  112.         End If
  113.     End Sub
  114. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement