// i am sending u the code of my form i have created
// it shows error when i select the value postgraduation in  //
combobox2 but it doesnt show error in value graduation
//it shows error  you cant Cannot set column 'qualification'. The // //
value violates the MaxLength limit of this column.and the id is not //
generating itselfalso plz help








Public Class Data
    Inherits System.Windows.Forms.Form
    Dim dr As DataRow
    Dim dt As DataTable
    Dim flag As Integer
    Dim dc As DataColumn
    Dim bm As BindingManagerBase



    Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdsave.Click
        'saves the entry in the textboxes and comboboxes in the form
        dt = DataSet11.Tables("myform")
        dr = dt.NewRow()
        dr(0) = txtname.Text
        dr(1) = txtlname.Text
        dr(2) = Val(txtage.Text)
        dr(3) = ComboBox2.SelectedItem
        dr(4) = ComboBox1.SelectedItem
        dr(5) = GroupBox1.Text
        dr(6) = txtid.Text
        dt.Rows.Add(dr)
        OleDbDataAdapter1.Update(DataSet11, "myform")
    End Sub

    Private Sub cmdreset_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdreset.Click
        'resets the text selected in form
        txtname.Text = ""
        txtlname.Text = ""
        txtage.Text = Val("")
        ComboBox2.SelectedItem = ""
        ComboBox1.SelectedItem = ""
        GroupBox1.Text = ""



    End Sub

    Private Sub Data_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        'form event
        bm = Me.BindingContext(DataSet11, "myform")

        OleDbDataAdapter1.Update(DataSet11, "myform")
        OleDbDataAdapter1.Fill(DataSet11)


    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
        'code for generating id
        Dim ctr, len As Integer
        Dim id1, idval As String
        dt = DataSet11.Tables("myform")
        len = (dt.Rows.Count - 1)
        dr = dt.Rows(len)
        id1 = dr("id")
        idval = Mid(id1, 2, 4)
        ctr = CInt(idval)
        If ctr >= 1 And ctr < 9 Then
            ctr = ctr + 1
            txtid.Text = "P100" & ctr

        ElseIf ctr >= 9 And ctr < 99 Then
            ctr = ctr + 1
            txtid.Text = "P200" & ctr

        ElseIf ctr >= 99 Then
            ctr = ctr + 1
            txtid.Text = "P300" & ctr
        End If



    End Sub


End Class

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to