none
How to "Add Query" on DataGridView

    Question

  • How to search DataGridView like on this video, see time (12.00)

    http://www.youtube.com/watch?v=W-QyHvtzXfk

    I do all that and he,but it seems that the codes are not the same for "Add Query" in vb 2010 as in vb 2008.


    Thursday, January 12, 2012 12:29 PM

Answers

  • Sorry, but I want to answer your question how it can be done in my opinion the best way using the wizard for the strongly typed dataset and tableadapters. Not replying on a video another MVP or who else has made (I did not look at it, so maybe it is better).

    I've created a query to select one value using the Northwind dataset.

    Then I added this code

    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim ta As New NorthwindDataSetTableAdapters.CategoriesTableAdapter
            Label1.Text = ta.ScalarQuery(CInt(TextBox1.Text))
        End Sub
    End Class
    


    This result in this

     


    Success
    Cor
    Monday, January 16, 2012 11:08 AM

All replies

  • Hi Falkon,

    Does the textBox1 display properly in the design mode of your project? If so, please check if you’ve resized the other controls in your code, that may cover the textbox.

    If not, you could move it to a properly position to make is visible when running .

    If I misunderstood anything, please feel free and let me know.

     

    Best regards,


    Shanks Zen
    MSDN Community Support | Feedback to us
    Monday, January 16, 2012 10:47 AM
    Moderator
  • Sorry, but I want to answer your question how it can be done in my opinion the best way using the wizard for the strongly typed dataset and tableadapters. Not replying on a video another MVP or who else has made (I did not look at it, so maybe it is better).

    I've created a query to select one value using the Northwind dataset.

    Then I added this code

    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim ta As New NorthwindDataSetTableAdapters.CategoriesTableAdapter
            Label1.Text = ta.ScalarQuery(CInt(TextBox1.Text))
        End Sub
    End Class
    


    This result in this

     


    Success
    Cor
    Monday, January 16, 2012 11:08 AM