473,387 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Consult Primary Key in a DataGrid Textbox

tsanalista
Hello everyone good morning?
Would you like some help on how to make an appointment with a DataGrid textbox using the filter to type in the textbox.
Use this form here tried but failed. Could someone pass me a solution?

Expand|Select|Wrap|Line Numbers
  1. //Code that lists all contacts in the Form
  2.   Public Sub AllContact(ByVal resul As Boolean)
  3.  
  4.         'Dim cliente As New Customers() 
  5.         Dim objContact As New DALContact()
  6.  
  7.         Try
  8.  
  9.             Dim ds As DataSet = objContact.AllContact() 
  10.  
  11.             Dim dt As DataTable = ds.Tables(0) 
  12.  
  13.             dv = dt.DefaultView
  14.  
  15.  
  16.             If ds.Tables(0).Rows.Count > 0 Then
  17.  
  18.                 With dv
  19.                     .AllowNew = False
  20.                     .AllowDelete = False
  21.                     .AllowEdit = False
  22.                     .Sort = " Pes_contact_Name ASC "
  23.  
  24.                 End With
  25.  
  26.  
  27.  
  28.                 gvContact.DataSource = dv
  29.                 bs.DataSource = ds
  30.  
  31.             End If
  32.  
  33.         Catch ex As Exception
  34.             MessageBox.Show(ex.Message)
  35.  
  36.                End Try
  37.  
  38.  
  39.     End Sub
  40.  
  41.  
  42.  
  43. //Code Textbox
  44. Private Sub txtSearchCustomers_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBuscaClientes.TextChanged
  45.  
  46.         Try
  47.  
  48.             Dim txtstring As Integer= Me.txtSearchCustomers.Text
  49.  
  50.             If rdbIDCustomers.Checked = True Then
  51.  
  52.  
  53.                 Dim dv As DataView = Me.gvContact.DataSource
  54.                 dv.RowFilter = "Pes_contact_ID LIKE '" & txtstring & "%'"
  55.                 Me.gvContact.DataSource = dv
  56.  
  57.  
  58.             End If
  59.  
  60.  
  61.         Catch ex As Exception
  62.             Throw ex
  63.         End Try
  64.  
  65.  
  66.     End Sub
  67.  
Nov 20 '12 #1

✓ answered by tsanalista

Okay thanks, but just getting here ... now thanks .. was missing I do a conversion here on the field. Type this:
dv.RowFilter = "Convert (Pes_contato_ID, 'System.String') LIKE '%" + txtString + "%'"

4 1510
Rabbit
12,516 Expert Mod 8TB
You haven't told us what the problem is. What's failed? You need to describe it so we know what needs to be fixed. If you're getting error messages, we need to know what those are and which lines the errors are on.
Nov 20 '12 #2
Okay thanks, but just getting here ... now thanks .. was missing I do a conversion here on the field. Type this:
dv.RowFilter = "Convert (Pes_contato_ID, 'System.String') LIKE '%" + txtString + "%'"
Nov 20 '12 #3
Rabbit
12,516 Expert Mod 8TB
I don't understand what you just said. Are you saying that you've found the solution and no longer need an answer to your question?
Nov 20 '12 #4
Yes, I found the problem .. thanks
Nov 21 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tetet B via .NET 247 | last post by:
I'm using VB.Net and trying to retrieve the data in the textboxcell of a datagrid after a successful display (used Databind).User can either display data or enter data in the textbox. I canalways get...
1
by: Agnes | last post by:
I need to limit the number of characters in the Textbox column in the datagrid. How can I do that ? Thanks
0
by: awightma | last post by:
Hi, I have a datagrid with a number of textboxes on it. I want one column of my table to be visible=false because it contains the id of the record from the table. For some reason when I set...
2
by: Maziar Aflatoun | last post by:
Hi everyone, I have this DataGrid that I bind to a DataTable. However, instead of displaying the column 'Qty', I like to place it in a textbox and display the value of Qty as the default value...
1
by: Irishmaninusa | last post by:
Hello Everyone, I have a datagrid and have used a text box as way to allow a user to edit items in the grid. My question for you is how is it possible to write code for the text change event of...
1
by: jason | last post by:
I've seen a few posts on this issue, but no clear solutions. I have a mulitiline textbox inside a datagrid. I use TemplateColumn to define as multiline with 3 rows. I have other field types...
6
by: Bruce D | last post by:
I have a datagrid (uggg) that I use and create the columns programmatically...see below. objCol = New DataGridTextBoxColumn objCol.MappingName = "amount" objCol.HeaderText = "Amount"...
0
by: Agnes | last post by:
Dim dgtbc_docno As DataGridTextBoxColumn = CType(dgStandard.TableStyles(0).GridColumnStyles("docno"), DataGridTextBoxColumn) dgtbc_docno.TextBox.CharacterCasing = CharacterCasing.Upper...
0
by: shbrittan | last post by:
I need to have my users type in instructions in either plain text or with imbedded html tags at their choice. The typed data along with other columns are stored in a sql database, then displayed in...
3
by: kingflux | last post by:
Hello, and thank you in advance for any help you can provide. Each line in our datagrid control contains a product number, description, and a textbox for the user to enter a quantity-to-order. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.