Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class TableGenerator
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Try
- If CInt(TextBox2.Text) > 1000 Then TextBox2.Text = "1000"
- Catch ex As Exception
- Try
- TextBox2.Text = (CInt(TextBox1.Text) + 1).ToString
- Catch exx As Exception
- TextBox1.Text = "1"
- TextBox2.Text = "2"
- End Try
- End Try
- If RadioButton1.Checked = True Then
- lua()
- ElseIf RadioButton2.Checked = True Then
- luavorhanden()
- End If
- End Sub
- Public Sub lua()
- Try
- RichTextBox1.Text = ""
- If Not CInt(TextBox1.Text) = Nothing And Not CInt(TextBox2.Text) = Nothing Then
- If CInt(TextBox1.Text) >= 0 And (CInt(TextBox2.Text) >= CInt(TextBox1.Text)) Then
- Dim curText As String = TextBox3.Text.Replace(" ", "_")
- If CheckBox1.Checked = True Then
- RichTextBox1.Text = "local " & TextBox3.Text & " = { "
- Else
- RichTextBox1.Text = TextBox3.Text & " = { "
- End If
- Dim standartText As String = TextBox4.Text
- For i As Integer = CInt(TextBox1.Text) To CInt(TextBox2.Text) Step 1
- RichTextBox1.Text = RichTextBox1.Text & vbNewLine & "[" & i.ToString & "] = " & standartText
- If i = CInt(TextBox2.Text) Then
- RichTextBox1.Text = RichTextBox1.Text & vbNewLine
- Else
- RichTextBox1.Text = RichTextBox1.Text & ","
- End If
- Next
- RichTextBox1.Text = RichTextBox1.Text & "}"
- Else
- MsgBox("Falsche EIngabe bei den Zahlenwerten!")
- End If
- End If
- Catch ex As Exception
- MsgBox("Bitte überprüfen sie ihre Eingaben!")
- End Try
- End Sub
- Public Sub luavorhanden()
- Try
- RichTextBox1.Text = ""
- If Not CInt(TextBox1.Text) = Nothing And Not CInt(TextBox2.Text) = Nothing Then
- If (CInt(TextBox1.Text) >= 0) And (CInt(TextBox2.Text) >= (CInt(TextBox1.Text))) Then
- Dim curText As String = TextBox3.Text.Replace(" ", "_")
- Dim standartText As String = TextBox4.Text
- For i As Integer = CInt(TextBox1.Text) To CInt(TextBox2.Text) Step 1
- RichTextBox1.Text = RichTextBox1.Text & vbNewLine & TextBox3.Text & "[" & i.ToString & "] = " & standartText
- Next
- Else
- MsgBox("Falsche EIngabe bei den Zahlenwerten!")
- End If
- End If
- Catch ex As Exception
- MsgBox("Bitte überprüfen sie ihre Eingaben!")
- End Try
- End Sub
- Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
- If RadioButton1.Checked = True Then
- CheckBox1.Enabled = True
- Else
- CheckBox1.Enabled = False
- CheckBox1.Checked = False
- End If
- End Sub
- Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click
- Me.Close()
- End Sub
- Private Sub Label5_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.MouseHover
- Label5.BackColor = Color.FromArgb(255, 190, 190, 190)
- End Sub
- Private Sub Label5_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.MouseLeave
- Label5.BackColor = Color.FromKnownColor(KnownColor.Gainsboro)
- End Sub
- Dim StartingPosition As Point
- Dim DragPosition As Point
- Public Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
- If e.Button = Windows.Forms.MouseButtons.Left Then
- StartingPosition = Me.Location
- DragPosition = Me.PointToScreen(New Point(e.X, e.Y))
- End If
- End Sub
- Public Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
- If e.Button = Windows.Forms.MouseButtons.Left Then
- Dim CursorPosition As Point = Me.PointToScreen(New Point(e.X, e.Y))
- Me.Location = New Point(StartingPosition.X + CursorPosition.X - DragPosition.X, _
- StartingPosition.Y + CursorPosition.Y - DragPosition.Y)
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement