473,327 Members | 1,997 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,327 software developers and data experts.

Control.Focus() broken in Framework 2.0 RTM?

Hi there,

I was using VS 2005 Beta 2 and was able to set the focus to any control on a
web form by calling its Focus() method, for instance:

btnContinue.Focus();

Today I upgraded to VS 2005 RTM and now I get an exception at runtime when
the code execution reaches the above line. The exception I get is this:

System.InvalidOperationException was unhandled by user code
Message="A form tag with runat=server must exist on the Page to use
SetFocus() or the Focus property."
Source="System.Web"

I did nothing to my project, and of course the control has a "runat=server"
attribute.

Any ideas?

Regards,

-Benton
Jan 5 '06 #1
1 1268
> Hi there,

I was using VS 2005 Beta 2 and was able to set the focus to any control on
a web form by calling its Focus() method, for instance:

btnContinue.Focus();

Today I upgraded to VS 2005 RTM and now I get an exception at runtime when
the code execution reaches the above line. The exception I get is this:

System.InvalidOperationException was unhandled by user code
Message="A form tag with runat=server must exist on the Page to use
SetFocus() or the Focus property."
Source="System.Web"


[Edit]
This only happens if I set the focus inside the Activate method of a View (I
use the Multiview control). Perhaps this change of behavior is by design?

Regards,

-Benton
Jan 5 '06 #2

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

Similar topics

10
by: Matt Fielder | last post by:
I have developed a custom control to be used in my application. My application includes a form designer, so the control can be hosted while designmode for the control is either true or false,...
6
by: Alex Bink | last post by:
Hi, I have a validating event on a textbox in which I want to prevent the user to leave the textbox without entering the right data. Only if he clicks on another specific control he is allowed...
7
by: |{evin | last post by:
I'm currently working on what has turned in to something much larger that I wanted it to be. The upside is that I'm getting $$ to do it... but anywho. I currently have textboxes set up to...
1
by: holysmokes99 | last post by:
I have a VB6 winforms application that has a .Net 2.0 user control (exposed via COM) that I made. No matter what I have tried, once the user control looses focus, it always requires a double-click...
1
by: holysmokes99 | last post by:
I have a VB6 Winform application that has a .Net 2.0 user control (exposed via COM Callable Wrapper) that I made. No matter what I have tried, once the user control looses focus, it always...
9
by: Zytan | last post by:
http://msdn2.microsoft.com/en-us/system.windows.forms.control.focus(VS.80).aspx this page says: "Focus is a low-level method intended primarily for custom control authors. Instead, application...
8
by: Chris | last post by:
Hi, i have in an content page a fieldset containing a label, an iframe and a textarea: <asp:Content ID="Content1" ContentPlaceHolderID="main" Runat="Server"> <fieldset style="width:650px;">...
0
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello Gurus, Using VS2005 with .NET Framework 2.0. I wrote a GUI control A derived from UserConstrol, this control contains another UserControl derived B which contains two Labels controls and...
2
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello experts, I posted a disturbing question in here:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.