473,738 Members | 10,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

find row in datagrid and move to it?

Hello,

If my datagrid is based on a dataTable (t1) and the
currency manager is also bound to t1 and I do a find on a
key
dim dRow As DataRow, t1 As DataTable
....
dRow = t1.Rows.find(so mekey)
If Not dRow Is Nothing

how can I move the currency manager to this row?

Thanks,
Rich
Nov 20 '05 #1
3 13575
Hi,

The dataview has a find method that returns the row number of a
sorted column. Use the currency manager to go to that row. If you need to
use a datatable you need to find the row number yourself. Here is a link to
an example that uses a dataview.
http://www.onteorasoftware.com/downl...taviewfind.zip

Ken
------------------

"Rich" <an*******@disc ussions.microso ft.com> wrote in message
news:7a******** *************** *****@phx.gbl.. .
Hello,

If my datagrid is based on a dataTable (t1) and the
currency manager is also bound to t1 and I do a find on a
key
dim dRow As DataRow, t1 As DataTable
...
dRow = t1.Rows.find(so mekey)
If Not dRow Is Nothing

how can I move the currency manager to this row?

Thanks,
Rich

Nov 20 '05 #2
Thank you for the example. It worked great (although I
had to modify it a little bit cause using Sql Server). I
am just starting out with VB.net (stepping up from com
VB). Anyway, I haven't worked with dataviews yet. So
this example was nice because that is next. But I did
come up with a kludgy sort of solution for the datagrid.
I hope maybe you could explain about var.GetType. GetType
is confusing me. Here is the solution I came up with:

Dim dRow As DataRow, ddRow() As DataRow
Dim t1 As DataTable, , str1 As Object
Dim i As Integer, j As Integer, k As Integer

t1 = ds3.Tables("Con tacts")
j = 27 '--->hardoce a value that I know is there
dRow = t1.Rows.Find(27 )
If Not dRow Is Nothing Then
ddRow = t1.Select()
For i = 0 To ddRow.GetUpperB ound(0)
str1 = ddRow(i)(0)
k = CType(str1, Integer)
If k = j Then
cma.Position = i
drg1.Select(drg 1.CurrentRowInd ex)
Exit For
End If
Next
End If

So if my dataRow (dRow) is not Nothing then I set up a
dataRow array ddRow() and loop through that. The real
kludgy part is that when ddRow(i)(0) = 27 I don't know how
to compare it to j (an Integer). So I set up an object
(str1) to this value, and the only way I could come up
with to extract the value was to set up another Integer, k
as above. How else could I compare the value stored in
ddRow(i)(0) to j?

Thanks again for your reply,
Rich
-----Original Message-----
Hi,

The dataview has a find method that returns the row number of asorted column. Use the currency manager to go to that row. If you need touse a datatable you need to find the row number yourself. Here is a link toan example that uses a dataview.
http://www.onteorasoftware.com/downl...taviewfind.zip

Ken
------------------

"Rich" <an*******@disc ussions.microso ft.com> wrote in messagenews:7a******* *************** ******@phx.gbl. ..
Hello,

If my datagrid is based on a dataTable (t1) and the
currency manager is also bound to t1 and I do a find on a key
dim dRow As DataRow, t1 As DataTable
...
dRow = t1.Rows.find(so mekey)
If Not dRow Is Nothing

how can I move the currency manager to this row?

Thanks,
Rich

.

Nov 20 '05 #3
Well, I think I figured out what var.GetType is about.
When you get that option I think it means

var2 = CType(var1, varType)

or

Console.Writeli ne(CType(var1, Integer)) for example.

Little by little I'm getting it.

-----Original Message-----
Thank you for the example. It worked great (although I
had to modify it a little bit cause using Sql Server). I
am just starting out with VB.net (stepping up from com
VB). Anyway, I haven't worked with dataviews yet. So
this example was nice because that is next. But I did
come up with a kludgy sort of solution for the datagrid.
I hope maybe you could explain about var.GetType. GetTypeis confusing me. Here is the solution I came up with:

Dim dRow As DataRow, ddRow() As DataRow
Dim t1 As DataTable, , str1 As Object
Dim i As Integer, j As Integer, k As Integer

t1 = ds3.Tables("Con tacts")
j = 27 '--->hardoce a value that I know is there
dRow = t1.Rows.Find(27 )
If Not dRow Is Nothing Then
ddRow = t1.Select()
For i = 0 To ddRow.GetUpperB ound(0)
str1 = ddRow(i)(0)
k = CType(str1, Integer)
If k = j Then
cma.Position = i
drg1.Select(drg 1.CurrentRowInd ex)
Exit For
End If
Next
End If

So if my dataRow (dRow) is not Nothing then I set up a
dataRow array ddRow() and loop through that. The real
kludgy part is that when ddRow(i)(0) = 27 I don't know howto compare it to j (an Integer). So I set up an object
(str1) to this value, and the only way I could come up
with to extract the value was to set up another Integer, kas above. How else could I compare the value stored in
ddRow(i)(0) to j?

Thanks again for your reply,
Rich
-----Original Message-----
Hi,

The dataview has a find method that returns therow number of a
sorted column. Use the currency manager to go to that

row. If you need to
use a datatable you need to find the row number

yourself. Here is a link to
an example that uses a dataview.
http://www.onteorasoftware.com/downl...taviewfind.zip

Ken
------------------

"Rich" <an*******@disc ussions.microso ft.com> wrote in

message
news:7a****** *************** *******@phx.gbl ...
Hello,

If my datagrid is based on a dataTable (t1) and the
currency manager is also bound to t1 and I do a find
ona key
dim dRow As DataRow, t1 As DataTable
...
dRow = t1.Rows.find(so mekey)
If Not dRow Is Nothing

how can I move the currency manager to this row?

Thanks,
Rich

.

.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
15125
by: Steve B. | last post by:
How do I find the column (index) number at runtime of a particular DataGrid column if I know the column header string //somthing like the following int x = datagrid.column;
3
4491
by: Rob | last post by:
You can find datagrid in page by refering the form. Gatagrid is a child control of Form. Here is the code ----------------- Dim ctl As New Control For Each ctl In Page.FindControl("form1").Controls If TypeOf ctl Is DataGrid Then Response.Write(ctl.ID)
3
1495
by: RJN | last post by:
Hi I need to find the datagrid height dynamically based on the no. of records in the grid. I have set the height for the Item style and alternating item style. But I can not depend on this since some of the records might get wrapped and hence I need to find this dynamically. Based on the grid height, I need to align another table in my page. Is there a way to do this? Thanks
5
1883
by: Ed Chiu | last post by:
Hi, Is there a way to sort a datagrid without the help of SQL server? I usually use ADO.Net to get a dataset from SQL sever then bind it to datagrid. Now I am asked to make datagrid support sorting, of course I can change my SQL statements by adding order by clause for sorting purposes. But I would like to know if there are other options. TIA
1
243
by: Simon Abolnar | last post by:
I have a table fixed width (758px), centered. Inside a table there is datagrid of fixed width (752px). If I open web page at full screen, everything is OK. If I resize window, table and datagrid move correctly. If I open web page with a small size window, table and datagrid are positioned on the left (this is OK). But when I resize a window, table move correctly, but not datagrid (it is still positioned on the left).
1
1532
by: Irfan | last post by:
hi, all In VB 2005 Beta i cant find dataGrid control in the toolbox, instead DataGridView is available. What is the differance between the two ? How can i get dataGrid Control? Thanks
7
1177
by: Mrozu | last post by:
Hi I have datagrid, with 2 columns Id and Name. I want, then i insert to datagrid, to column name "d", datagrid move to record where value of name is "d_____" , when i insert to name "da", move to record where name value is "da____" etc. Is it possible?? In many programs i can see it, but i can't do it in my own:) thx
0
918
by: fia | last post by:
Hi I have made my DataGrid move to the next cell on TAB and Enter (the code below) and it works fine, but when standing in the first cell on the new row (last row) and pressing TAB or Enter the cursor moves to the second cell on the PREVIOUS row and not the new row. Why? And if I MOUSE_CLICK in the first cell on the new row, I can press TAB and it works fine. Is there a way I can make pressing the TAB work like Mouse_Clicking the new...
0
1055
by: Matt | last post by:
Ok, given that this is a windows ocx, it should be pretty easy to do this but I just haven't been able to figure it out. What I have is a datagrid on my form populated with various pieces of information. What I would like is to be able to start typing and have the datagrid move to the thing I'm typing if it exists. For example given the list: Ant
8
2319
by: inFocus | last post by:
Hello, I am new to python and wanted to write something for myself where after inputing two words it would search entire drive and when finding both names in files name would either copy or move thoe files to a specified directory. But couple of attempts did not work as desired this is one of them. Could someone help fix it or maybe give a better example.
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9476
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.