pharaon's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
83 (0.03 per day)
Joined:
18-October 07
Profile Views:
3,472
Last Active:
User is offline Nov 20 2014 11:42 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   pharaon has not set their status

Posts I've Made

  1. In Topic: vs.2013 browser crash

    Posted 18 Nov 2014

    dos any one know about webkit.net
  2. In Topic: vs.2013 browser crash

    Posted 15 Nov 2014

    well other users going to use this application, so it wont be nice thing to let other users go through this steps, also I'm afraid to do it in code and then antivirus caught my application as a virus going to change the registry
    is there any other solution?
  3. In Topic: many data with few textboxs

    Posted 29 Aug 2014

    View Postdemausdauth, on 28 August 2014 - 06:39 AM, said:

    Think about what you need the controls on your form to do.
    It seems like you want your button to have 2 responsibilities - initially load your data into your grid and also to add new data to the grid. What I would do is apply some SOLID principles and separate out the responsibility of what some methods do.

    For instance - maybe you should have a method to initially load the data to the grid, one for adding rows of data to the grid, one for saving data to the database, one for querying the database.

    Another thing to think about is this - you want to add a row to your datagridview, but in your code you don't actually seem to be doing anything that would add to your datagridview. If you are following the flow of - add the textbox data to bindingsource and then re query to fill the datagridview again, it doesn't seem to me to that the data in the binding source is being saved to the database. Granted I don't/haven't used the BindingSource myself so I don't know the subtleties of this control, but it doesn't appear that the textbox data is being persisted to the database.

    Last thought - sometimes you have to go back to square one. Get your code to do one thing at a time, add buttons to perform a specific function - load data, save textboxes to grid, save to database, etc... once you have these specific processes working, you can start to combine them (if necessary).


    I agree with you but at this stage I'm not trying to save to the database I'm just trying to bind controls to table then save that table at once to the database later
    so I'm using the DGV to check what data been saved to the table and I have trouble saving Date/Time to the table

    any one know how to bind Date/Time to table in the right way
  4. In Topic: many data with few textboxs

    Posted 21 Aug 2014

    I done this code so far
       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            BindControls()
            BindingSource1.AddNew()
    
            BindingSource1.EndEdit()
            DataGridView1.DataSource = BindingSource1
        End Sub
    
        Private Sub BindControls()
            Dim adapter As New OleDb.OleDbDataAdapter("select Pname,Birthdate,Qualification,Job,Health,Religion,Tel from members", obj.con)
            Dim insert As New OleDb.OleDbCommand("INSERT INTO members (Pname,Birthdate,Qualification,Job,Health,Religion,Tel) VALUES (@ID,@Pname,@Birthdate,@Qualification,@Job,@Health,@Religion,@Tel)", obj.con)
            adapter.InsertCommand = insert
            insert.Parameters.Add("@Pname", OleDbType.VarChar, 100, "Pname")
            insert.Parameters.Add("@Birthdate", OleDbType.DBDate, 10, "Birthdate")
            insert.Parameters.Add("@Qualification", OleDbType.VarChar, 100, "Qualification")
            insert.Parameters.Add("@Job", OleDbType.VarChar, 100, "Job")
            insert.Parameters.Add("@Health", OleDbType.VarChar, 100, "Health")
            insert.Parameters.Add("@Religion", OleDbType.VarChar, 100, "Religion")
            insert.Parameters.Add("@Tel", OleDbType.VarChar, 100, "Tel")
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
    
            Dim table As New DataTable
            adapter.FillSchema(table, SchemaType.Source)
            'table.Rows.Add(TextBox4.Text.Trim, DateTimePicker2.Value, TextBox6.Text.Trim, TextBox7.Text.Trim, TextBox8.Text.Trim, TextBox9.Text.Trim, CInt(TextBox10.Text))
            BindingSource1.DataSource = table
    
            TextBox4.DataBindings.Add("text", BindingSource1, "Pname")
            DateTimePicker2.DataBindings.Add("Value", BindingSource1, "Birthdate")
            TextBox6.DataBindings.Add("Text", BindingSource1, "Qualification")
            TextBox7.DataBindings.Add("text", BindingSource1, "Job")
            TextBox8.DataBindings.Add("text", BindingSource1, "Health")
            TextBox9.DataBindings.Add("text", BindingSource1, "Religion")
            TextBox10.DataBindings.Add("text", BindingSource1, "Tel")
    
        End Sub
    


    but the DGV only show empty row when I fill the textboxes with data and click the button the DGV show empty row why?
  5. In Topic: many data with few textboxs

    Posted 21 Aug 2014

    any one have an idea for how to get this done

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

pharaon has no profile comments yet. Why not say hello?