Results 1 to 10 of 10

Thread: Datagrid help!!!! Using VB.NET [RESOLVED]

  1. #1

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92

    Datagrid help!!!! Using VB.NET [RESOLVED]

    Can someone help me i have a report screen where the user builds the select command for a DataAdapter based on the checkboxes the tick.

    once they have chosen the info they want they press the preview button which runs the select command and fills a dataset. Then the datasource of the Datagrid is set to the dataset.

    This works fine but if you want to run the report again say because the first one didn't have all data needed when the preview button is pressed again it clears the dataset (first i did this by rows.clear, columns.clear then i tried clearing the dataset with ("Tablename").clear and then finally i've tried re-creating the dataset via ds=new dataset and re doing the tables).

    It runs the same function as before but instead of getting rid of the old data and displaying the new data it adds it'self on to the end so i have the old columns then the new columns next to it.

    have tried everything i can think of can anyone help me???


    i attach my code and forms.
    Attached Files Attached Files
    Last edited by nokia8210; Feb 11th, 2004 at 10:44 AM.

  2. #2

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92

    Question *BUMP*

    I really need help ASAP as i can't roll out my software till this is fixed

  3. #3
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    Connecticut
    Posts
    257
    Before you re-fill the dataset, try re-setting the dataset object to nothing (objDataSet = Nothing).

  4. #4

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92
    have tried that and still the same any other ideas???

  5. #5
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi



    You want

    objDataset.Clear



    Too easy isn't it?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  6. #6

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92
    have tried that didn't work have sorted it now rather than setting the datasource to the dataset I bound it instead.

  7. #7
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    I've just looked at my application and realised that is what I used, but I also had to set my data adaptor to nothing.

    When I tried to use DataSource I had difficulties in getting the table to display the rows.
    Last edited by taxes; Feb 11th, 2004 at 05:23 AM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  8. #8

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92
    yes tried every thing but it works now

  9. #9
    New Member
    Join Date
    Feb 2004
    Posts
    7

    try this

    Private Sub newDataset()
    dsReport = New DataSet

    dsReport.clear()

    dsReport.Tables.Add("Report")
    dsReport.Tables.Add("Broker")
    dsReport.Tables.Add("Claim")


    SqlBroker.Fill(dsReport.Tables("Broker"))
    SqlClaim.Fill(dsReport.Tables("Claim"))
    End Sub

  10. #10

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92
    Thanks everyone i have it working now as i said before it didn't like having a datasource set to it so i got rid of the 'dgData.Datasource =' bit and bound the data to the dataset in the load event this has sorted out my problem.

    thanks again for all your help guys

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width