Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

combobox.focus in a datagrid.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jereviscious - 25 Feb 2008 17:13 GMT
Hi all

I've added a combobox to the datagrid control using the following method

dataGridTextBoxColumn7.TextBox.Controls.Add(comboControl);

The problem is that when I tab to the Column that contains the combobox, the
focus is on the underlying textbox in the datagrid.

I've tried doing this:

comboControl.focus();

But unfortunately what happens here is that it forces a tab to the next
column! I can't get the comboControl to get the focus without clicking on it
with the mouse! very annoying. Any help would be appreciated.

MSDE 2003

.NET FRAMEWORK 1.1
jereviscious - 28 Feb 2008 21:59 GMT
Well I didn't have a lot of responses, so I've done some research over the
last couple of days, and here is what I've found. This would work great,
except for the fact that when you use ComboBoxStyle.DropDown, then the KeyUp
message isn't passed!!! (It does pass under ComboBoxStyle.DropDownList). So
I am still stuck after 2 days of work.

Any help would be greatly appreciated.

I sincerely hope that microsft makes this process easier in the future.
Ironically, doing these sorts of data entry screens was trivial in MS access
97! Have we regressed??!??
private const int WM_KEYUP = 0x101;

// The WndProc method corresponds exactly to the Windows WindowProc
function.

// For more information about processing Windows messages, see the
WindowProc

// function documentation in the Windows Platform SDK reference located in

// the MSDN Library.

protected override void WndProc(ref System.Windows.Forms.Message theMessage)

{

// Ignore KeyUp event to avoid problem with tabbing the dropdown.

if (theMessage.Msg == WM_KEYUP)

{

return;

}

else

{

base.WndProc(ref theMessage);

}

}

The Keyup event from the tab key is causing it to "skip" over the cell that
has the combobox, so several people use this method
> Hi all
>
[quoted text clipped - 16 lines]
>
> .NET FRAMEWORK 1.1
jereviscious - 29 Feb 2008 14:17 GMT
Finally, the solution...
private const int WM_KEYUP = 0x101;

// The WndProc method corresponds exactly to the Windows WindowProc
function.

// For more information about processing Windows messages, see the
WindowProc

// function documentation in the Windows Platform SDK reference located in

// the MSDN Library.

public override bool PreProcessMessage(ref System.Windows.Forms.Message
theMessage)

{

// Ignore KeyUp event to avoid problem with tabbing the dropdown.

if (theMessage.Msg == WM_KEYUP)

{

return true;

}

else

{

base.WndProc(ref theMessage);

}

return false;

> Well I didn't have a lot of responses, so I've done some research over the
> last couple of days, and here is what I've found. This would work great,
[quoted text clipped - 66 lines]
>>
>> .NET FRAMEWORK 1.1

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.