473,769 Members | 2,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Localizable + PasswordChar = Handle error

I'm creating a user control that has a handful of controls on it (19 in
total). One of the controls on the UC is a textbox for a user's password, so
I've set the PasswordChar property to "*". I rebuild and all is well.

The problem arises when I have the PasswordChar set, and then try to set
Localizable to True for the UC. If I set Localizable to true and have
PasswordChar set and rebuild, Visual Studio 2005 will then try to reload the
User Control in the designer but will show the message "Error creating window
handle." The only way to fix it is to open the Resx file and remove my
PasswordChar property and rebuild.

I can replicate this every time. Is this a bug in VS 2005? What's going on?
Aug 9 '06 #1
7 2266
Hi Jeff,

Thanks for your reply. I tried doing what you said in a new project and it
worked fine. However, on my original control it continues to happen. Here
is the stack trace available from the designer:

Error creating window handle.
Hide

at System.Windows. Forms.NativeWin dow.CreateHandl e(CreateParams cp)
at System.Windows. Forms.Control.C reateHandle()
at System.Windows. Forms.TextBoxBa se.CreateHandle ()
at System.Windows. Forms.TextBox.g et_PasswordChar ()
at System.Windows. Forms.Design.Te xtBoxDesigner.g et_PasswordChar ()

I'm aware that I can probably start my user control all over, but I'd rather
not do that unless absolutely necessary. I'd also like an understanding as
to why, exactly, this is happening.

Thanks.

- ryan.

""Jeffrey Tan[MSFT]"" wrote:
Hi,

I have created a sample test usercontrol project in VS2005 C#. I dropped a
textbox and a button on the Form set TextBox.Passwor dChar to '*'. After
setting Localizable property to true and switch the language to English
United State, I set PasswordChar to '*' and rebuild. I can see the
PasswordChar with value '*' in UserControl1.en-US.resx file. But I did not
get any exception in the designer. I have attached the sample project in
this reply.

Have you tried to create a new project with above steps? Can this be
reproduced? If so, please provide the sample little project to me. Thanks.

Additionally, can you provide the detailed call stack information regarding
this error? I think this error is Win32Exception.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights
Aug 10 '06 #2
Hi Ryan,

Yes, I understand your concern.

It seems that this exception is generated in NativeWindow.Cr eateHandle
method, while NativeWindow class is trying to create the TextBox control.
Below is the source code of NativeWindow.Cr eateHandle method:

public virtual void CreateHandle(Cr eateParams cp)
{
IntSecurity.Cre ateAnyWindow.De mand();
if (((cp.Style & 0x40000000) != 0x40000000) || (cp.Parent ==
IntPtr.Zero))
{
IntSecurity.Top LevelWindow.Dem and();
}
lock (this)
{
this.CheckRelea sed();
NativeWindow.Wi ndowClass class1 =
NativeWindow.Wi ndowClass.Creat e(cp.ClassName, cp.ClassStyle);
lock (NativeWindow.c reateWindowSync Object)
{
if (this.handle == IntPtr.Zero)
{
class1.targetWi ndow = this;
IntPtr ptr1 =
UnsafeNativeMet hods.GetModuleH andle(null);
IntPtr ptr2 = IntPtr.Zero;
int num1 = 0;
try
{
if ((cp.Caption != null) &&
(cp.Caption.Len gth 0x7fff))
{
cp.Caption = cp.Caption.Subs tring(0,
0x7fff);
}
ptr2 =
UnsafeNativeMet hods.CreateWind owEx(cp.ExStyle , class1.windowCl assName,
cp.Caption, cp.Style, cp.X, cp.Y, cp.Width, cp.Height, new HandleRef(cp,
cp.Parent), NativeMethods.N ullHandleRef, new HandleRef(null, ptr1),
cp.Param);
num1 = Marshal.GetLast Win32Error();
}
catch (NullReferenceE xception exception1)
{
throw new
OutOfMemoryExce ption(SR.GetStr ing("ErrorCreat ingHandle"), exception1);
}
class1.targetWi ndow = null;
if (ptr2 == IntPtr.Zero)
{
throw new Win32Exception( num1,
SR.GetString("E rrorCreatingHan dle"));
}
this.ownHandle = true;
HandleCollector .Add(ptr2,
NativeMethods.C ommonHandles.Wi ndow);
}
}
}
}
As you can see that there are 2 points where "Error creating window handle"
exception will throw. One is OutOfMemoryExce ption and another is
Win32Exception. Can you confirm if your exception is OutOfMemoryExce ption
or Win32Exception.

Normally the OutOfMemoryExce ption is caused by too many user objects are
created in the process which may hit the process limitation. You may try to
remove some controls from the designer to see if this will eliminate the
exception.

While for Win32Exception, it is caused by CreateWindowEx win32 API calling
failed. You may check Win32Exception. NativeErrorCode property to see what
exact error CreateWindowEx win32 API is meeting.

Additionally, I have tried to perform some research in our internal
database, but all the "Error creating window handle" errors I found do not
have the code path from TextBoxDesigner .get_PasswordCh ar. They are all
runtime exceptions. It seems that Microsoft did not recieve your exact
problem before.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 11 '06 #3
Hey Jeff,

Thanks again for your reply. I'm on a roll with finding new things, it
seems like ("Configuration ErrorException when reading protected config..." is
another one). I can't scientifically prove that the exception I'm receiving
would be the Win32 exception, but I'd be very surprised if it was an memory
exception. My user control has less than 20 controls on it, and I have 2
gigs of ram in my machine - so memory shouldn't be a problem.

But like I said, I haven't been able to reproduce this on any other form -
only the one. Perhaps I'll simply try and delete the text box and re-add it.
I'll post back and let you know how that goes.

Cheers - and thanks for all the help!

- ryan.

""Jeffrey Tan[MSFT]"" wrote:
Hi Ryan,

Yes, I understand your concern.

It seems that this exception is generated in NativeWindow.Cr eateHandle
method, while NativeWindow class is trying to create the TextBox control.
Below is the source code of NativeWindow.Cr eateHandle method:

public virtual void CreateHandle(Cr eateParams cp)
{
IntSecurity.Cre ateAnyWindow.De mand();
if (((cp.Style & 0x40000000) != 0x40000000) || (cp.Parent ==
IntPtr.Zero))
{
IntSecurity.Top LevelWindow.Dem and();
}
lock (this)
{
this.CheckRelea sed();
NativeWindow.Wi ndowClass class1 =
NativeWindow.Wi ndowClass.Creat e(cp.ClassName, cp.ClassStyle);
lock (NativeWindow.c reateWindowSync Object)
{
if (this.handle == IntPtr.Zero)
{
class1.targetWi ndow = this;
IntPtr ptr1 =
UnsafeNativeMet hods.GetModuleH andle(null);
IntPtr ptr2 = IntPtr.Zero;
int num1 = 0;
try
{
if ((cp.Caption != null) &&
(cp.Caption.Len gth 0x7fff))
{
cp.Caption = cp.Caption.Subs tring(0,
0x7fff);
}
ptr2 =
UnsafeNativeMet hods.CreateWind owEx(cp.ExStyle , class1.windowCl assName,
cp.Caption, cp.Style, cp.X, cp.Y, cp.Width, cp.Height, new HandleRef(cp,
cp.Parent), NativeMethods.N ullHandleRef, new HandleRef(null, ptr1),
cp.Param);
num1 = Marshal.GetLast Win32Error();
}
catch (NullReferenceE xception exception1)
{
throw new
OutOfMemoryExce ption(SR.GetStr ing("ErrorCreat ingHandle"), exception1);
}
class1.targetWi ndow = null;
if (ptr2 == IntPtr.Zero)
{
throw new Win32Exception( num1,
SR.GetString("E rrorCreatingHan dle"));
}
this.ownHandle = true;
HandleCollector .Add(ptr2,
NativeMethods.C ommonHandles.Wi ndow);
}
}
}
}
As you can see that there are 2 points where "Error creating window handle"
exception will throw. One is OutOfMemoryExce ption and another is
Win32Exception. Can you confirm if your exception is OutOfMemoryExce ption
or Win32Exception.

Normally the OutOfMemoryExce ption is caused by too many user objects are
created in the process which may hit the process limitation. You may try to
remove some controls from the designer to see if this will eliminate the
exception.

While for Win32Exception, it is caused by CreateWindowEx win32 API calling
failed. You may check Win32Exception. NativeErrorCode property to see what
exact error CreateWindowEx win32 API is meeting.

Additionally, I have tried to perform some research in our internal
database, but all the "Error creating window handle" errors I found do not
have the code path from TextBoxDesigner .get_PasswordCh ar. They are all
runtime exceptions. It seems that Microsoft did not recieve your exact
problem before.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 11 '06 #4
Hi Ryan,

Oh, it seems that your another ConfigurationEr rorException issue is still
working with my colleague Steven Cheng. I have just discussed with him with
this issue, and he is still researching and discussing this issue with US
developer team. I am sure he will give you a follow up in that thread ASAP.

Regarding our issue, yes, I agree that the simplest way may be delete and
re-add the TextBox and have a try, I hope this will resolve the problem.
Anyway, please feel free to feedback result here.

If you are curious, we have several ways to troubleshoot the issue by
debugging the VS2005 IDE:

1. You may use windbg to attach the VS2005 IDE project, and set a
breakpoint on user32!CreateWi ndowExW and user32!CreateWi ndowExA, then you
may break in NativeWindow.Cr eateHandle method while calling
UnsafeNativeMet hods.CreateWind owEx(). Then you may check the return value
and Last win32 error of CreateWindowEx. Note: since CreateWindowEx is a
frequently called API, windbg may break in various other places which are
not we want to break.

2. You may use another instance of VS2005 IDE to debug your problematic
VS2005 IDE project, in the debug "Exceptions ..." dialog, you may open the
"first chance" exception break for Win32Exception and OutOfMemoryExce ption.
Then, whenever one of these 2 exceptions are thrown, the VS2005 debugger
will break, and you can find out which exception generated this "Error
creating window handle" error message.

Note: by using debuggers, you'd better set the correct symbol path for it,
then the debugger will have the correct symbol information for all FCL
assemblies.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 14 '06 #5
Hi Ryan,

Have you reivewed my last reply? Does it make sense to you? If you still
need any help or have any concern, please feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 16 '06 #6
Hello Jeff,

Sorry for the late reply - I've read it and understand it, however I
haven't yet tried your proposed method of debugging. I tried deleting
and readding the textbox, but it did not work. Also, I received the
same error on a different user control I was creating (not entirely
sure why). I decided to give up on the PasswordChars and simply
utilize the UseDefaultPassw ordChars property (or whatever it's called)
for 3 reasons:

1. It works no matter what
2. It's standard in windows, and
3. I didn't know about it in the first place.

Thanks.

- ryan.

"Jeffrey Tan[MSFT]" wrote:
Hi Ryan,

Have you reivewed my last reply? Does it make sense to you? If you still
need any help or have any concern, please feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 16 '06 #7
Hi Ryan,

Yes, VS IDE issues and design-time issues are hard to troubleshoot without
intensive debugging of the VS IDE, however, finding the root cause is not
always that simple.

Anyway, I am glad to see that you have found a suitable workaround for your
issue. If you need further help, please feel free to post. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 17 '06 #8

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

Similar topics

3
719
by: Rick | last post by:
In VB .Net how do I make the PasswordChar property of a Textbox work out to be that nice big round dot that we see in most system password fields? There is no special character I can see to place in the PasswordChar property to do this. Thanks.
1
6004
by: John | last post by:
I am creating an application which is password controlled on startup. I created a textbox for the user to enter the password. However, I would like to also have a menu option so the user can choose to see '*' in the password box, or the plain text that they are typing in. I want to do this because it is for pocketpc2002 and the characters might not always appear as you think you are writing them in, hence the user option. The problem...
3
583
by: rosty | last post by:
This is taken from MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html /frlrfsystemwindowsformstextboxclasspasswordchartopic.asp) "When the PasswordChar property is set to true, cut, copy, and paste actions in the control using the keyboard are not allowed, regardless of whether the Multiline property is set to true or false." Is it a typo in MSDN or something? How can i set PasswordChar to true since it is...
5
10375
by: Hareth | last post by:
Is there a way to take a text, from a textbox & later passwordChar the text. I'm not using a masked textbox. I tried: textBox1.PasswordChar = '*'; but this didn't change my text. I know how to passwordchar, but I don't know how to take a text THEN passwordchar it...Any code samples will be great!
7
9731
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
3
8912
by: Michael Brown | last post by:
Hi there, After applying the "Localizable" attribute to my form using the (form) properties window in VS, I was expecting to see "" preceding my form's class in code (added automatically by the IDE). I don't however. Can someone point out where this info is stored. Thanks.
0
9423
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10047
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.