473,587 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't make a TextBox to get focus - Compact Framework.

I have a windows form (compact framework) which has three
hidden controls (label, textbox and listbox) at startup.
The controls are enabled, set visible and shown
programatically but I am not able to get the textbox to
get the focus.

Part of the code is below:

Any idea? Thank you.

Carlos Lozano

private void ShowObjects(boo l lTogle)
{
// Show or hide controls depending on lTogle

this.Controls.G etEnumerator(). Reset();
int Idx = this.Controls.C ount-1, fCtrl = 0;
IEnumerator myEnum = this.Controls.G etEnumerator();
while (Idx >= 0 && fCtrl < 24)
{
// Find all the buttons to hide or show them.
// I also tried sendtoback and bringtofront.

myEnum.MoveNext ();
Object myObject = myEnum.Current;
if (myObject.GetTy pe().ToString() .EndsWith("aBut ton"))
{
if (fCtrl < 24)
{
aButton Obj = (aButton) myObject;
if (lTogle)
{
Obj.Show();
Obj.BringToFron t();
}
else
{
Obj.Hide();
Obj.SendToBack( );
}
Obj.Enabled = lTogle;
fCtrl ++;
}
}
Idx --;
}
lName.Enabled = !lTogle; // Label
tName.Enabled = !lTogle; // TextBox
listBox1.Enable d = !lTogle; // ListBox, yes I am sure.
lName.Visible = !lTogle;
tName.Visible = !lTogle;
listBox1.Visibl e = !lTogle;
if (lTogle)
{
lName.SendToBac k();
tName.SendToBac k();
listBox1.SendTo Back();
lName.Hide();
tName.Hide();
listBox1.Hide() ;
}
else
{
lName.BringToFr ont();
tName.BringToFr ont();
listBox1.BringT oFront();
lName.Show();
tName.Show();
listBox1.Show() ;
}
// After they are show I call tName.focus() from another
routine.
}
}

Nov 15 '05 #1
1 6347
> // After they are show I call tName.focus() from another
routine.


Is your other routine getting called? Why don't you just set the focus here?
Is the focus being set to any other control AFTER you set the focus to
tName?

-JG
Nov 15 '05 #2

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

Similar topics

0
2596
by: Earle Oxner | last post by:
We are developing an application on PocketPC2002 platform and we are trying to make webservice calls using HTTPS. HTTP works fine but HTTPS does not work. The same code which doesn't work on PocketPC, works on the laptop with .NET Framework. I was hoping you could help me with answering some questions: 1. Does HTTPS work for the...
2
2849
by: Duncan | last post by:
I am using the evaluation version of CE.NET 4.1. I had also installed the release version of the Compact Framework. I uninstalled the CE.NET 4.1, and then realized I needed it again and reinstalled it. I also installed all the QFEs. When I tried to reinstall the release Compact Framework, I get a message that it is already installed...
4
7208
by: Mad Scientist Jr | last post by:
I have a textbox that i am adding to (in codebehind of ASP.NET) and need to ensure that the focus is scrolled to the bottom of the textbox each time the page refreshes, and then set focus to a 2nd textbox (which the user types input into). I have tried a couple functions I found posted online but they don't work (see below) The closest I...
2
1987
by: Hans Kesting | last post by:
Is it possible to mix code meant for the CompactFramework and code meant for the standard framework? We are trying to make PDA and light-weight "laptop" versions of one application. This means a lot of functionality is identical (or at least similar). As the compact framework is a subset (correct?) of the full framework, we had the idea of...
3
5120
by: Keith Smith | last post by:
Is there an easy way to make the {Enter} key take the cursor to the next control without using a KeyDown event on each control?
15
4028
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE CALLING FORM! This is very bad for me, because in my application, Form1 responds to an ENTER keypress by calling Form2. If the user closes Form2 via an...
4
2655
by: anoehre | last post by:
Hi! I have a multi-line text box in a compact framework c# application. I need a method to calculate the excact number of lines of the textbox and a method to calculate the number of used lines after the text box was filled with a string. Any ideas? Greetings,
1
2067
by: Vincent | last post by:
I keep receiving the above error message in Microsoft Access when I attempt to click on one of the text boxes on my form. I have done some searching and came across a couple of posts that stated their may be a space in one of the event procedure properties of the text box, but I see nothing. I have even tried backspacing and deleting from...
4
5946
by: =?Utf-8?B?UmVuYXVkIExhbmdpcw==?= | last post by:
Hello, I have a strange yet very simple problem with the asp.net Textbox web control. On an empty asp.net page, add a single asp:TextBox control with Autopostback=false with nothing else on the page. according to the doc, hitting Enter while the TextBox has focus should do nothing since Autopostback=false. The problem i have is that it...
0
7849
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...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
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...
0
8220
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...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3844
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...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
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...

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.