Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UserControl Focus Problem
Message
De
17/05/2009 23:00:54
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01398893
Message ID:
01400350
Vues:
45
Hi Kevin,

Did you find an answer to this? I think you can probably do it by setting the focus to the TabPage first, then to the oShipItems, then to the TextBox.

~~Bonnie



>I am adding a user control to a TabPage at runtime. The control has a textbox on it. I cannot seem to get the focus to go into the text box.
>
>I have:
>
>
>// Set the tag of the page to the enum
>oNewPage.Tag = csApplication.Panes.ship_items;
>
>// Create the usercontrol and call the setup method on it
>crlShipItems oShipItems = new crlShipItems();
>oShipItems.Setup();
>
>// Add the user control to the tab
>tabPages.TabPages[iPage].Controls.Add(oShipItems);
>oShipItems.Dock = DockStyle.Fill;
>
>// Set the focus on the control
>oShipItems.Select();
>
>
>Then in the control's enter event I have:
>
>
>private void crlShipItems_Enter(object sender, EventArgs e)
>{
>    txtPartNo.Focus();
>}
>
>
>The problem is that the textbox isn't getting the focus. The event fires, the focus just doesn't set.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform