Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
DataGridView in a modal dialog questions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Shannon Broskie  
View profile  
 More options Feb 12 2006, 8:32 pm
Newsgroups: microsoft.public.dotnet.framework.windowsforms
From: Shannon Broskie <ShannonBros...@discussions.microsoft.com>
Date: Sun, 12 Feb 2006 17:32:29 -0800
Local: Sun, Feb 12 2006 8:32 pm
Subject: DataGridView in a modal dialog questions
Hello,

When using the DataGridView in a modal dialog, (I'm using the DataGridView
in a generic lookup dialog) I'm having a couple of issues I hope someone can
help me with:

- 1 -

I have FullRowSelect for my selection mode.  I have two buttons assigned to
the typical Accept and Cancel button properties on the form.  Hitting ESC
works for cancelling out of the form, but hitting enter causes the selected
row in the DataGridView to move down one.  I would like the enter key to
trigger the accept button.  If the DataGridView does not have focus, hitting
enter works properly closing the dialog.  I've tried intercepting the enter
key at the form level and setting the DialogResult to ok but even when I set
handled = true, the DataGridView still moves down to the next record.  Any
thoughts?

- 2 -

The generic selection dialog, have among its optional properties, to pass in
a StringCollection of pre-selected items.  The pre-selected items are found
using the following code:

foreach (string s in preSelectedItems)
{
  string tmp = string.Format("{0} LIKE '{1}%'", lookupField, s.ToUpper());
  DataRow[] rows = list.Table.Select(tmp);
  if (rows.Length > 0)
  {
    int position = bindingSource.Find(lookupField, rows[0][lookupField]);
    if (position >= 0)
      grdList.Rows[position].Selected = true;
  }

}

My problem is the pre-selected items are not selected once the dialog is
modally shown.  Just the first row of the DataView that was passed in.  The
BindingSource returns a proper row position but it seems like something
resets the view once the form is actually shown.

Thanks for any suggestions on these two items!


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google