编辑错误..只有最近才被编辑 [英] edit error..only the recent were edit

查看:73
本文介绍了编辑错误..只有最近才被编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Public Class Form5
    Dim aft As billing
    Dim ms1 As Integer = FreeFile()
    Dim lRec As Integer = bill()

    Private Sub form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FileOpen(ms1, FN, OpenMode.Random, , , Len(aft))
        Do While Not EOF(ms1)
            FileGet(ms1, aft)
            ComboBox1.Items.Add(aft.CusID)
        Loop
        FileClose(ms1)

        TextBox3.Enabled = False
        'Label2.Enabled = False
        TextBox6.Enabled = False
        TextBox1.Enabled = False
        TextBox2.Enabled = False
        TextBox4.Enabled = False
        RadioButton6.Enabled = False
        RadioButton5.Enabled = False
        TextBox7.Enabled = False
        TextBox10.Enabled = False
        TextBox11.Enabled = False
        TextBox12.Enabled = False
        TextBox13.Enabled = False
        MaskedTextBox4.Enabled = False
        MaskedTextBox5.Enabled = False
        MaskedTextBox1.Enabled = False
        MaskedTextBox2.Enabled = False
        TextBox8.Enabled = False
        TextBox5.Enabled = False
        DateTimePicker2.Enabled = False

        btnedit.Enabled = False
        RadioButton1.Enabled = False
        RadioButton2.Enabled = False
        RadioButton3.Enabled = False
        RadioButton4.Enabled = False
        RadioButton7.Enabled = False
    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        RadioButton1.Enabled = True
        RadioButton2.Enabled = True
        RadioButton3.Enabled = True
        RadioButton4.Enabled = True
        RadioButton7.Enabled = True

        FileOpen(ms1, FN, OpenMode.Random, , , Len(aft))
        Do While Not EOF(ms1)
            FileGet(ms1, aft)
            If aft.CusID = ComboBox1.Text Then
                TextBox3.Text = aft.CusID
                'Label2.Text = aft.times
                TextBox6.Text = aft.meterno
                TextBox1.Text = aft.Fnam
                TextBox2.Text = aft.Lnam
                TextBox4.Text = aft.Add
                RadioButton6.Text = aft.conntype   'conn type
                RadioButton5.Text = aft.conntype  'conn type
                TextBox7.Text = aft.pres
                TextBox10.Text = aft.prev
                TextBox11.Text = aft.usage
                TextBox12.Text = aft.amount
                TextBox13.Text = aft.total
                MaskedTextBox4.Text = aft.datecovered   'period
                MaskedTextBox5.Text = aft.datecovered 'period
                MaskedTextBox1.Text = aft.due
                MaskedTextBox2.Text = aft.discon
                TextBox8.Text = aft.afterdue
                TextBox5.Text = aft.signature 'signature
                DateTimePicker2.Text = aft.dates 'date
            End If
        Loop
        FileClose(ms1)
    End Sub
    Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnedit.Click
        FileOpen(ms1, FN, OpenMode.Random, , , Len(aft))
        Seek(ms1, position)
        aft.CusID = Val(TextBox3.Text)
        'aft.times = Label2.Text
        aft.meterno = TextBox6.Text 'm#
        aft.Fnam = TextBox1.Text
        aft.Lnam = TextBox2.Text
        aft.Add = TextBox4.Text
        aft.conntype = RadioButton6.Text 'conn type
        aft.conntype = RadioButton5.Text 'conn type
        aft.pres = Val(TextBox7.Text)
        aft.prev = Val(TextBox10.Text)
        aft.usage = Val(TextBox11.Text)
        aft.amount = Val(TextBox12.Text)

        FilePut(ms1, aft)

        If MsgBox("are you sure you want to save the changes?", MsgBoxStyle.Question + MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
            MsgBox("File Successfully Updated.", MsgBoxStyle.Information)
            Call del()
            ''
            TextBox6.Enabled = False
            RadioButton1.Checked = False
            ComboBox1.Text = ""
            btnedit.Enabled = False

            RadioButton7.Enabled = False
            RadioButton2.Enabled = False
            RadioButton3.Enabled = False
            RadioButton4.Enabled = False
            RadioButton1.Enabled = False
            ''
            ''
            TextBox1.Enabled = False
            RadioButton7.Checked = False
            ComboBox1.Text = ""
            btnedit.Enabled = False

            RadioButton1.Enabled = False
            RadioButton2.Enabled = False
            RadioButton3.Enabled = False
            RadioButton4.Enabled = False
            RadioButton7.Enabled = False
            ''
            ''
            TextBox2.Enabled = False
            RadioButton2.Checked = False
            ComboBox1.Text = ""
            btnedit.Enabled = False

            RadioButton7.Enabled = False
            RadioButton1.Enabled = False
            RadioButton3.Enabled = False
            RadioButton4.Enabled = False
            RadioButton2.Enabled = False
            ''
            ''
            TextBox4.Enabled = False
            RadioButton3.Checked = False
            ComboBox1.Text = ""
            btnedit.Enabled = False

            RadioButton7.Enabled = False
            RadioButton2.Enabled = False
            RadioButton1.Enabled = False
            RadioButton4.Enabled = False
            RadioButton3.Enabled = False
            ''
            ''
            TextBox1.Enabled = False
            TextBox2.Enabled = False
            RadioButton4.Checked = False
            ComboBox1.Text = ""
            btnedit.Enabled = False

            RadioButton7.Enabled = False
            RadioButton2.Enabled = False
            RadioButton3.Enabled = False
            RadioButton1.Enabled = False
            RadioButton4.Enabled = False
            ''
        Else
            TextBox6.Focus()
            TextBox1.Focus()
            TextBox2.Focus()
            TextBox4.Focus()

            If TextBox1.Enabled = False And RadioButton7.Checked = False And ComboBox1.Text = "" And btnedit.Enabled = False Then
            Else
                TextBox1.Focus()
            End If
        End If
        FileClose(ms1)
    End Sub
    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked = True Then
            TextBox6.Enabled = True
            TextBox6.Focus()
            btnedit.Enabled = True
        ElseIf RadioButton1.Checked = False Then
            TextBox6.Enabled = False
            btnedit.Enabled = False
        End If
    End Sub
    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        If RadioButton3.Checked = True Then
            TextBox4.Enabled = True
            TextBox4.Focus()
            btnedit.Enabled = True
        ElseIf RadioButton3.Checked = False Then
            TextBox4.Enabled = False
            btnedit.Enabled = False
        End If
    End Sub
    Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
        If RadioButton4.Checked = True Then
            TextBox1.Enabled = True
            'TextBox1.Focus()
            TextBox2.Enabled = True
            'TextBox2.Focus()
            btnedit.Enabled = True
        ElseIf RadioButton4.Checked = False Then
            TextBox1.Enabled = False
            TextBox2.Enabled = False
            btnedit.Enabled = False
        End If
    End Sub
    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked = True Then
            TextBox2.Enabled = True
            TextBox2.Focus()
            btnedit.Enabled = True
        ElseIf RadioButton2.Checked = False Then
            TextBox2.Enabled = False
            btnedit.Enabled = False
        End If
    End Sub
    Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged
        If RadioButton7.Checked = True Then
            TextBox1.Enabled = True
            TextBox1.Focus()
            btnedit.Enabled = True
        ElseIf RadioButton7.Checked = False Then
            TextBox1.Enabled = False
            btnedit.Enabled = False
        End If
    End Sub

    Private Sub del()
        TextBox3.Clear()
        TextBox6.Clear()
        TextBox1.Clear()
        TextBox2.Clear()
        TextBox7.Clear()
        TextBox4.Clear()
        TextBox5.Clear()
        TextBox8.Clear()
        TextBox10.Clear()
        TextBox11.Clear()
        TextBox12.Clear()
        TextBox13.Clear()
        MaskedTextBox1.Clear()
        MaskedTextBox2.Clear()
        MaskedTextBox4.Clear()
        MaskedTextBox5.Clear()
        RadioButton1.Checked = False
        RadioButton2.Checked = False
    End Sub
End Class

推荐答案

在有人可以帮助您之前,您需要提供更多信息(错误消息,发生的位置等).

另外,调试源代码以查看问题出在哪里.
这可能会帮助您解决问题.
You need to provide some more information (the error message, where it occurs etc) before someone can help you.

Also, debug the source code to see where exactly the problem occurs.
That might help you solve it.


这篇关于编辑错误..只有最近才被编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆