473,666 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS2500 - How to set 'currently viewed rows' ??

Greetings:

Working on a VS2005 C# program.

I have a DataGridView control that is bound to dataviews generated by
various database queries. i.e. the user enters search criteria and the
query results end up in the grid. The DataViewGrid is Read Only. The user
has the option of selecting a single record from the grid which causes all
of the associated database record values to become available for edit in an
area outside of the DataViewGrid.

Once the user completes the data updates and saves the data back to the
database I >refresh << the DataGridView to reflect the updates.

I have figured out how to re-select the DataGridView record that was
updated.

How do I ensure that the selected/updated record is visible in the
DataGridView window after the requery ???

i.e. if the window can display 10 rows and the data set is 30 rows long ...
how to I ensure that row #21 appears in the DataGridView window ??

Thanks in advance.

Barry
in Oregon


Aug 30 '07 #1
3 3241
Hi Oregon,

Based on my understanding, your question is how to ensure a particular
DataGridViewRow to be visible in a DataGridView. If I'm off base, please
feel free to let me know.

You have two options to do this.

One option is to set the DataGridView's CurrentCell property to the first
cell of the specified DataGridViewRow . Once we set a DataGridViewRow as the
current row, this row will scroll into the visible area of the
DataGridView. The following is a sample which sets the 5th DataGridViewRow
as the current row:

this.dataGridVi ew1.CurrentCell = this.dataGridVi ew1.Rows[4].Cells[0]

The other option is to set the DataGridView's
FirstDisplayedS crollingRowInde x property to the row index of the specified
DataGridViewRow . The following is a sample:

this.dataGridVi ew1.FirstDispla yedScrollingRow Index = 4;

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 30 '07 #2
Bar
Linda,

Thank you for the quick reply and aplogies for the late reply on my
part.

I used your " this.dataGridVi ew1.CurrentCell =
this.dataGridVi ew1.Rows[4].Cells[0]" option and it worked just as I
had hoped. Now when a user updates data derived from a specific
DataGridView row, I can ensure that the updated information appears as
one of the rows in the refreshed DataGridView display window.

Many Thanks !

Barry
in Oregon

On Aug 30, 1:45 am, v-l...@online.mic rosoft.com (Linda Liu [MSFT])
wrote:
Hi Oregon,

Based on my understanding, your question is how to ensure a particular
DataGridViewRow to be visible in a DataGridView. If I'm off base, please
feel free to let me know.

You have two options to do this.

One option is to set the DataGridView's CurrentCell property to the first
cell of the specified DataGridViewRow . Once we set a DataGridViewRow as the
current row, this row will scroll into the visible area of the
DataGridView. The following is a sample which sets the 5th DataGridViewRow
as the current row:

this.dataGridVi ew1.CurrentCell = this.dataGridVi ew1.Rows[4].Cells[0]

The other option is to set the DataGridView's
FirstDisplayedS crollingRowInde x property to the row index of the specified
DataGridViewRow . The following is a sample:

this.dataGridVi ew1.FirstDispla yedScrollingRow Index = 4;

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer tohttp://msdn.microsoft. com/subscriptions/managednewsgrou ps/default.asp...
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) athttp://msdn.microsoft. com/subscriptions/support/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 6 '07 #3
Linda,

I am using the FirstDisplayedS crollingRowInde x to scroll the view to the
bottom without changing the selected "CurrentCel l". If the window is small
before the scroll is called, I get an InvalidOperatio nException "No room is
available to display rows" event. How can I avoid this error and yet have
the grid scroll to the bottom without changing the current cell?
--
mnlarsen
"Linda Liu [MSFT]" wrote:
Hi Oregon,

Based on my understanding, your question is how to ensure a particular
DataGridViewRow to be visible in a DataGridView. If I'm off base, please
feel free to let me know.

You have two options to do this.

One option is to set the DataGridView's CurrentCell property to the first
cell of the specified DataGridViewRow . Once we set a DataGridViewRow as the
current row, this row will scroll into the visible area of the
DataGridView. The following is a sample which sets the 5th DataGridViewRow
as the current row:

this.dataGridVi ew1.CurrentCell = this.dataGridVi ew1.Rows[4].Cells[0]

The other option is to set the DataGridView's
FirstDisplayedS crollingRowInde x property to the row index of the specified
DataGridViewRow . The following is a sample:

this.dataGridVi ew1.FirstDispla yedScrollingRow Index = 4;

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 17 '07 #4

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

Similar topics

14
3887
by: NotGiven | last post by:
I am guessing I would hold a variable of when it's opened, then in the script that runs when the page is offloaded, I coudl calcualte it. How do you store a time variable? How do you calculate the amount of time (seconds) based on two timestamps? Thanks for your help and/or links to articles on the subject!
4
1712
by: la_haine | last post by:
I have a collection of pages that are designed to be called into an iframe (named displayView), and the managers don't want people to be able to view them unless they're in that iframe. If I use the following javascript: <script language="javascript" type="text/javascript"> function bing() { if (!top.document.displayView) { document.writeln("sorry, you can't view this"); } }
0
3486
by: Firona | last post by:
Hi, I have a DataGridView in a form which I populate with some data. I would need to know which rows the user is currently viewing. I found the dataGridView.DisplayedRowCount() method which only tells me how many rows the user is seeing but not which ones. Is there any way I can tell which rows are displayed?
3
4887
by: Margie | last post by:
Hello all, after getting no where with my Access 2007 database problem for an entire week I figured I could use some outside help. Wanting to skill myself in Access, I decided to make a movie database, something I always wanted. It took me some trial and error, but as it now stands, I made several tables (Companies, Cast, Genre, Country, Character, Director, Status, Movies)... The table Movies contains all the info on each movie while the...
4
3063
by: ASPnewb1 | last post by:
Hello, I have a 2-dimensional array created from the following text file: data1=asdfawe data2=2 data3=223d data4=22
2
3087
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, I have a gridview with paging enabled. I need to know how many rows of data are on the last page!!! When I look at the Gridview1.Rows.Count in the Page_Load, it always returns the number that the paging is set to... currently 13, but if there are only 4 rows on the last page, I need to know that there are only 4 rows.
5
5314
by: eBob.com | last post by:
I am so frustrated. I've been working all weekend on what I thought would be a simple script. I never find it easy to look at someone else's code, but if someone can help with this I would be very grateful. The script is .... <script type="text/javascript"> var parentwin = external.menuArguments; var doc = parentwin.document; var x = doc.getElementsByTagName("table") alert(x.length + " table things")
11
5178
by: sanju | last post by:
Dear All, I have html table and this table contains 10 Rows and 2 column, I want every time this HTML page is called by the user to view the rows Randomly. How can I do this from JavaScript? waiting for reply Thank you
4
5436
by: ravir81 | last post by:
Hi, I am currently working on excel validation using Perl. I am new to Excel validation but not for Perl. I have a question regarding one of the validation. Could anyone please tell me how to get the number of duplicate rows based on a particular cell value of each these duplicate rows. I mean all the cell values of a row will not be duplicated but a individual columns cell value will be duplicated and I need to create a separate excel with...
0
8360
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8876
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...
1
8556
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,...
0
8642
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2774
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1777
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.