|
I am using Charles Petzold's "Programming Microsoft Windows with C#" to learn Windows Forms programming. Unfortunately, it does not include using the IDE. I have modified one of his examples of a tree to include several panels and various controls to test the class member functions. I have also added controls with the IDE. A couple of times, my hard work of listing the Nodes for the tree has disappeared as I use the IDE to add components, modify the size of the panels, etc. I have gotten a little smarter and included the node-code in a separate "populateTree()" method. The typing is saved, but the call to the function disappeared on me once.
How can I avoid this. Is this happening because I put the code in the "InitiateComponents()" method?
When you come to a fork in the road, take it! Y. Berra
|
|
|
|
|
That's a known bug of VS.NET 1.0. Hopefully, this will be fixed in next release.
In the mean time, don't hesitate to add the using System.Windows.Forms.TreeView; statement. And don't hesitate to use a fully qualified method name, instead of a short name (assuming the using xxx; provides the compiler with the missing path).
In fact, the mess occurs when you switch from the code to the designer view. The designer view takes the opportunity at this very moment to rebuild the Form from scratch and, because there's that tiny bug, it may decide on his own there's no more treectrl. And it removes it. Either the tree ctrl disappears from the designer view, or methods disappear, etc.
By using more explicit namespaces, as I have said earlier, I have never got this problem back again.
Good luck then!;P
How low can you go ? (MS rant)
|
|
|
|
|
Donald Blachly wrote:
Is this happening because I put the code in the "InitiateComponents()" method?
Yes, never ever ever ever ever put code in the InitializeComponent() method. (There is a reason there is a comment saying "Required method for Designer support - do not modify the contents of this method with the code editor." Its because the forms designer places all of its initialization code in that method re-writing it when major/minor changes occur.)
IIRC, this is part of the reason Petzold didn't use the IDE for the book; the code generated by the designer isn't the prettiest.
Instead put your code after the InitializeComponent() call in the constructor or override the OnLoad method or attach a handler to the Load event.
James
Sig code stolen from David Wulff
|
|
|
|
|
Thanks for both the above comments.
/don
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
|
|
|
|
|
Donald Blachly wrote:
I will not put code in the InitializeComponent() method!
James
Sig code stolen from David Wulff
|
|
|
|
|
James T. Johnson wrote:
Yes, never ever ever ever ever put code in the InitializeComponent() method
Hmmm, I have a habit of doing just that, especially if InitializeComponent isn't collapsed.
So far I haven't been bitten. But I remember, Delphi used to make designer generated code uneditable by default. I always thought that was a good idea.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
I was wondering how to tell a Validation Control to perform validation only when the next button of a form is pressed and not perform validation when previous button is pressed/
Also, I was wondering how you can retrieve IP address information of users hitting your site in C#?
thanks
|
|
|
|
|
This should really go in the ASP.NET forum...
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
Anonymous wrote:
I was wondering how to tell a Validation Control to perform validation only when the next button of a form is pressed and not perform validation when previous button is pressed
well, if you name your next button submit, and the previous button submit, then you can check to see which of the two where pressed, by checking the value of the submit argument sent to the page, it would have a value of the text on the button pressed. I think that should work, but i dont know how to retrieve the variable information.
Anonymous wrote:
Also, I was wondering how you can retrieve IP address information of users hitting your site in C#?
cant help you here, but in php you can just duse the $REMOTE_ADDR variable. at david stone.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Hey you're back! How was the trip?
Nnamdi Onyeyiri wrote:
but in php you can just duse the $REMOTE_ADDR variable. at david stone.
But in ASP.NET you can just use Request.ServerVariables and then you use the $REMOTE_ADDR stuff just the same... So 2 at you.
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
David Stone wrote:
Hey you're back! How was the trip?
OK, got a little boring, it was more of a look at your inheritance trip than a holiday.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Anonymous wrote:
I was wondering how to tell a Validation Control to perform validation only when the next button of a form is pressed and not perform validation when previous button is pressed/
Set CausesValidation to false on the Previous button.
Anonymous wrote:
Also, I was wondering how you can retrieve IP address information of users hitting your site in C#?
Request.UserHostAddress
Paul
I think there're pieces of me you've never seen - Tori Amos, Tear in Your Hand
|
|
|
|
|
how to list all the PCs within a group using Active Directory??
|
|
|
|
|
I think you can start from here:
http://www.codeproject.com/csharp/ServerComboBox.asp[^]
It use NetServerEnum function.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I know that it's somewhere within the System.DirectoryServices namespace...
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
Hi,
I just installed the Visual Studio .Net (Chinese Version) under
Japanese windows 2000. There are no problems for load/open a solution or
project and complie and run the projects. But the problems occurs when
i create a new project or solution. After new project, set the type of the application and set the path, and then "OK", I got an error:
"Microsoft JScript Compile error".
Would you please tell me what is my mistake?
Thanks in advance!
chen
|
|
|
|
|
May be your security level (Internet settings) is too high and you don't allow javascript to execute.
Other than that, I believe this is not a programming question, and would suggest you to post either on a public MS VS.NET NG (likely to get an answer), or even http://support.microsoft.com
How low can you go ? (MS rant)
|
|
|
|
|
Hi, Rod,
Thank you very much for your reply!
I reall want to know how to check the "security level" and make it low?
Best Regards,
chen
|
|
|
|
|
In the Windows control panel, double-click the Internet Options icon. Then, in the security tab, click the "Local Intranet zone" (I believe you the issue is not from the untrusted Internet zone), and either :
- in the dropdown list, choose Low
- or check the radio buttons so that everything is accepted and enabled. Just to make sure you are not restricting anything to execute.
How low can you go ? (MS rant)
|
|
|
|
|
I have an object derived from MarshalByRefObject. Here's my problem:
If I have:
public class TheTransfer : System.MarshalByRefObject, IRemoting
{
public Form theForm;
//more blablabla
}
and run Soapsuds on the assembly it works fine. But if I use a class derived from Form, it won't. I get "Invalid schema data, Value cannot be null".
public class MyForm : Form
{
}
public class TheTransfer : System.MarshalByRefObject, IRemoting
{
public MyForm theForm;
}
Did anybody see this before?
Thanks
|
|
|
|
|
Could be that MyForm isn't serializable. *shrug* What are you trying to do
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
I am converting a java app to C# and the passwords were encrypted with an algorithm written in java which uses the following to convert from a char to an int. Does anyone know the equivalent for C#?
<br />
int result = Character.getNumericValue('b');
The 'equivalent' in C# returns different results...
<br />
double d12 = Char.GetNumericValue('b');
or
<br />
int i12 = Convert.ToInt32('b');
What is the cause (other than java being a joke!) and how can I get the correct result?
Thanks,
ed
Every time I walk into a singles bar I can hear Mom's wise words: "Don't pick that up, you don't know where it's been!"
|
|
|
|
|
I can't think of any reason, in any context, for 'b' to be '11'. I know capital A is 65 in ASCII, I'm not sure if lowercase b is ASCII 98. In any case, why don't you just subtract 87 ? Or is it not just for lowercase letters ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I was about to do that then the meeting started so I fired off the question to see if anyone had run across it. I'm going to try that in the morning and walk the keyboard and see if everything fits. If not...do some sort of lookup.
Java!!
Thanks,
ed
Check out the stir on theserverside.com[^]!!
|
|
|
|
|
Have you checked out MS's Java to C# convertor? Last time I checked it was still in early beta and didnt do such a good job (think it only supports Java 1.1), but it definately looked handy
"There are no stupid question's, just stupid people."
|
|
|
|