最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

数据库技术及应用 答案 实验一

来源:动视网 责编:小OO 时间:2025-10-01 17:26:53
文档

数据库技术及应用 答案 实验一

sy1-1PublicClassForm1PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickTextBox2.Text=TextBox1.SelectedTextTextBox2.Font=TextBox1.FontEndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSyste
推荐度:
导读sy1-1PublicClassForm1PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickTextBox2.Text=TextBox1.SelectedTextTextBox2.Font=TextBox1.FontEndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSyste
sy1-1

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        TextBox2.Text = TextBox1.SelectedText

        TextBox2.Font = TextBox1.Font

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        TextBox1.Font = New Font("隶书", 25)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        TextBox1.Font = New Font("幼圆", 15)

    End Sub

End Class

Sy1-2

Public Class Form1

    Dim x As Single, y As Single, z%

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        TextBox1.Focus()

    End Sub

    Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus

        x = Val(TextBox1.Text)

        If Int(x) - x <> 0 Then

            MsgBox("不是一个整数")

            TextBox1.Text = ""

        End If

    End Sub

    Private Sub TextBox2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.LostFocus

        y = Val(TextBox2.Text)

        If Int(y) - y <> 0 Then

            MsgBox("不是一个整数")

            TextBox2.Text = ""

        End If

        If y Mod 2 = 1 Then

            MsgBox("不是一个偶数")

            TextBox2.Text = ""

        End If

        

    End Sub

    Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress

        If y - 2 * x < 0 Then

            MsgBox("不存在")

        End If

        z = y - 2 * x

        z = z / 2

        TextBox3.Text = Str(z) + "          " + Str(x - z)

    End Sub

End Class

Sy1-3

Imports System.Math

Public Class Form1

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        End

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        TextBox1.Text = ""

        TextBox2.Text = ""

        TextBox3.Text = ""

        TextBox4.Text = ""

        TextBox5.Text = ""

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim a, b, c As Double

        a = Val(TextBox1.Text)

        b = Val(TextBox2.Text)

        c = Val(TextBox3.Text)

        If b * b - 4 * a * c < 0 Then

            TextBox4.Text = Format(-b / (2 * a), "0.00") & "+" & Format(Sqrt(-b * b + 4 * a * c) / (2 * a), "0.00") & "i"

            TextBox5.Text = Format(-b / (2 * a), "0.00") & "-" & Format(Sqrt(-b * b + 4 * a * c) / (2 * a), "0.00") & "i"

        Else

            TextBox4.Text = Format((-b + Sqrt(b * b - 4 * a * c)) / (2 * a), "0.00")

            TextBox5.Text = Format((-b - Sqrt(b * b - 4 * a * c)) / (2 * a), "0.00")

        End If

    End Sub

End Class

Sy1-4

Public Class Form1

    Dim s(9) As Integer

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Randomize(TimeOfDay.ToOADate())

        Dim i%, max%, min%

        Dim aver As Single

        For i = 0 To 9

            s(i) = Rnd() * 70 + 30

        Next

        max = s(0)

        min = s(0)

        aver = 0

        For i = 0 To 9

            TextBox1.Text += s(i) & "     "

            If s(i) > max Then

                max = s(i)

            End If

            If s(i) < min Then

                min = s(i)

            End If

            aver = aver + s(i)

        Next

        aver = aver / 10

        TextBox1.Text += vbNewLine & "max=" & max & "     "

        TextBox1.Text += "min=" & min & "     "

        TextBox1.Text += "aver=" & aver

    End Sub

End Class

Sy1-5

Public Class Form1

    Private Sub RichTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles RichTextBox1.KeyPress

        If (e.KeyChar = Chr(13)) Then

            If (IsH(CInt(RichTextBox1.Text))) Then

                Label3.Text &= RichTextBox1.Text.Trim & "★" & vbCrLf

            Else

                Label3.Text &= RichTextBox1.Text.Trim & vbCrLf

            End If

            RichTextBox1.Text = ""

        End If

    End Sub

    Function IsH(ByVal n%) As Boolean

        Dim s$ = CStr(n)

        Dim length% = Len(s)

        Dim i%, m%

        m = length \\ 2

        Dim flag As Boolean = True

        For i = 1 To m

            If (Mid(s, i, 1) <> Mid(s, length - i + 1, 1)) Then

                flag = False

                Exit For

            End If

        Next

        Return flag

    End Function

End Class

Sy1-6

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        ComboBox1.Items.Add("联想")

        ComboBox1.Items.Add("方正")

        ComboBox1.Items.Add("DELL")

        ComboBox1.Items.Add("兼容机")

        ComboBox1.SelectedIndex = 0

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ListBox1.Items.Clear()

        ListBox1.Items.Add(ComboBox1.SelectedItem)

        If RadioButton1.Checked Then ListBox1.Items.Add(RadioButton1.Text)

        If RadioButton2.Checked Then ListBox1.Items.Add(RadioButton2.Text)

        If RadioButton3.Checked Then ListBox1.Items.Add(RadioButton3.Text)

        If RadioButton4.Checked Then ListBox1.Items.Add(RadioButton4.Text)

        If RadioButton5.Checked Then ListBox1.Items.Add(RadioButton5.Text)

        If CheckBox1.Checked Then ListBox1.Items.Add(CheckBox1.Text)

        If CheckBox2.Checked Then ListBox1.Items.Add(CheckBox2.Text)

        If CheckBox3.Checked Then ListBox1.Items.Add(CheckBox3.Text)

    End Sub

End Class

Sy1-7

Public Class Form1

    Dim s(9) As Integer

    Private Sub 随机产生10个数据ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 随机产生10个数据ToolStripMenuItem.Click

        ListBox1.Items.Clear()

        Randomize(TimeOfDay.ToOADate())

        Dim i%

        For i = 0 To 9

            s(i) = Rnd() * 100

        Next

        For i = 0 To 9

            ListBox1.Items.Add(s(i))

        Next

    End Sub

    Private Sub 删除最小值ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 删除最小值ToolStripMenuItem.Click

        Dim min%, i%, t%

        min = s(0)

        t = 0

        For i = 0 To 9

            If s(i) < min Then

                min = s(i)

                t = i

            End If

        Next

        ListBox1.Items.RemoveAt(t)

    End Sub

    Private Sub 删除最大值ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 删除最大值ToolStripMenuItem.Click

        Dim max%, i%, t%

        max = s(0)

        t = 0

        For i = 0 To 9

            If s(i) > max Then

                max = s(i)

                t = i

            End If

        Next

        ListBox1.Items.RemoveAt(t)

    End Sub

    Private Sub 统计ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 统计ToolStripMenuItem.Click

        Form2.Show()

        Dim min%, max%, i%

        Dim aver As Double

        min = s(0)

        aver = 0

        For i = 0 To 9

            aver = aver + s(i)

            If s(i) < min Then

                min = s(i)

            End If

        Next

        Form2.TextBox1.Text = min

        aver = aver / 10

        max = s(0)

        For i = 0 To 9

            If s(i) > max Then

                max = s(i)

            End If

        Next

        Form2.TextBox2.Text = max

        Form2.TextBox3.Text = aver

    End Sub

    Private Sub 结束ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 结束ToolStripMenuItem.Click

        End

    End Sub

End Class

Sy1-8

public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        OpenFileDialog1.Filter = "(*.txt)|*.txt|(*.rtf)|*.rtf|all file(*.*)|*.*"

        OpenFileDialog1.FilterIndex = 1

        OpenFileDialog1.ShowDialog()

        RichTextBox1.LoadFile(OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText)

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        SaveFileDialog1.Filter = "(*.rtf)|*.rtf|(*.txt)|*.txt|All files|*.*"

        SaveFileDialog1.FilterIndex = 1

        SaveFileDialog1.Title = "保存文字"

        SaveFileDialog1.ShowDialog()

        RichTextBox1.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText)

    End Sub

    Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        Dim j%

        Static i% = 0

        j = InStr(i + 1, RichTextBox1.Text, ".net")

        If j = 0 Then

            MsgBox("no find")

        Else

            RichTextBox1.Focus()

            RichTextBox1.SelectionStart = j - 1

            RichTextBox1.SelectionLength = 4

            i = j

        End If

    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click

        End

    End Sub

End Class

文档

数据库技术及应用 答案 实验一

sy1-1PublicClassForm1PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickTextBox2.Text=TextBox1.SelectedTextTextBox2.Font=TextBox1.FontEndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSyste
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top