|
Hello you!
I need Your HELP.
I have my own TreeView Nodes Editor, in order to add 'MyTreeNode'', like node which are ComboBox and so.
I have two classes. one inherit from 'TreeView' and the other from 'TreeNode'.
In 'MyTreeView' i override 'Nodes' (keyword- new) in order to open my custom editor.
In public partial class MyTreeView : TreeView, I use the next statement:
[
DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor(typeof(NodesTypeEditor), typeof(UITypeEditor)),
]
new public TreeNodeCollection Nodes
{
get { return base.Nodes; }
set
{
TreeNode[] myTreeNodeArray = new TreeNode[((TreeNodeCollection)value).Count];
((TreeNodeCollection)value).CopyTo(myTreeNodeArray, 0);
((TreeNodeCollection)value).Clear();
this.Nodes.AddRange(myTreeNodeArray);
}
}
but the DesignerSerializationVisibility create the next code, which produce casting error on run time:
MyCheckTreeNode myCheckTreeNode1 = ((MyCheckTreeNode)(new TreeNode("TreeNode")));
I need it to be :
MyCheckTreeNode myCheckTreeNode1 = new MyCheckTreeNode("TreeNode");
In the editor i use TreeView and PropertyGrid. the code in 'Add CheckBox Node' is:
treeView1.Nodes.Add(new MyCheckTreeNode("TreeNode"));
How can i fix it???
Please Help me. I need it fast.
Thanks,
Ran S'
|
|
|
|
|
Hi, I have a form, let's say Form1, in Form1 I have some code in its Load event handler, now I want to close Form1 if the code in its Load event handler throws an exception.
this.close() simply doesn't work from inside the Load event handler.
Thanks for any suggestions...
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
I don't know why do you want to close a form immediatelly, but the metod is:
<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
this.Close();<br />
}<br />
It must works!
|
|
|
|
|
What about
Application.Exit();
|
|
|
|
|
Simply you can :
void form1_load(object sender,eventargs e)
{
CloseIt();
}
void CloseIt()
{
this.Close();
}
|
|
|
|
|
hi,
Waleed wrote:
now I want to close Form1 if the code in its Load event handler throws an exception.
The reason why your form didn't close ( but crashed ) is because exceptions change flow of your program. You have to wrap exception throwing code with try-catch block.
void Page_Load(...)
{
try
{
YourCodeWhichThrowsAndException();
}
catch{ this.Close(); }
}
Does it help?
David
|
|
|
|
|
A much better method would be to determine if your form needs to be displayed before you even instantiate it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello, thanks for all your replies .. I'm afraid though the problem hasn't been solved .. as I said in my first post, using this.Close() doesn't work at all, doesn't matter if you call it directly from the Load event handler (let's say Form1_Load) or put it in a method and call this method from within Form1_Load.. it still doesn't work!
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
I agree with Dave Kreskowiak, but in this case I have to put all the code in another form, for example if I have two forms, Form1 and Form2, and I want to open Form2 from within Form1, in this case I have to put all the code I have in Form2_Load in that place in Form1 where I create a new instance of Form2, this is something I don't want to do. To make things clearer, let's say I have a form on which I display data retrieved from a database, I put the code that retrieves the data in the Load event handler for that form, now what I want is that if something goes wrong while retrieving the data, the form is closed before it's even shown to the user.
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
There could be two approaches that I can think of that may be of use. The first would involve creating a Timer event, and if the data fails, start the Timer and allow the Load event to close and maybe a second or something liket that before firing it to close the Form. The second is to use a ShowDialog() error box inside the load before the form itself gets loaded, and upon the error window exiting, close the form. I have done the second, however using Application.Exit() so it may not work for simply closing the form. I would say the timer is the best approach.
Also do you just have one form that you want to close or is a child form (havent read through the posts) because if I do this.Close() in the main or child in the Load it does close it. Maybe you have to Garbage Collect or cleanup the variables?
|
|
|
|
|
Then put the code into a seperate public function of Form2 and call it prior to showing it (either catch the exception in Form1 or catch it in the function and return False indicating something went wrong).
|
|
|
|
|
i need to get more information about png files becouse i know it support vector object datas over the image bitmap inside.
How can i create a png with that data (like it does fireworks).
Or are there web side that give information about this file format?
|
|
|
|
|
|
Hi all,
I am building a spell checker web application in c# using the InteropServices Word.dll. It works fine on my localhost but it doesn't work on a web server remotely.
What do I have to do in order to make it work?
Please Help
Tony
|
|
|
|
|
|
Kumar,
Thanks for that information. The office components are installed on the web server but still I cannot access the spell checker remotely. The web application hangs when the spell checker is called.
Any more ideas will be much appreciated
Thanks
Tony
|
|
|
|
|
Hello
Im trying to make a function that will access a label on an aspx file. I think im supposed to use something along the lines
System.Web.UI.WebControls.Label etc
Does anyone know if im on the right track or way off? Any help greatly appreciated!
|
|
|
|
|
livez wrote:
Im trying to make a function that will access a label on an aspx file
From a windows application?
|
|
|
|
|
LongHC wrote:
From a windows application? yeah
looking like this atm
foreach (Control ctrl in currentPage.Controls)<br />
{<br />
foreach (Control c in ctrl.Controls)<br />
{<br />
<br />
if (c.ID == "myLabel")<br />
{<br />
i = ctrl.Controls.IndexOf(c);<br />
j = currentPage.Controls.IndexOf(ctrl);<br />
<br />
((System.Web.UI.WebControls.Label)(currentPage.Controls[j]).Controls[i]).Text = "<script>alert('warning')</script>";<br />
}<br />
}<br />
}
and is working ok. But it looks so clumsy
|
|
|
|
|
|
Vasudevan Deepak Kumar wrote:
Did you try FindControl?
thx for the tip, ill check it out.
|
|
|
|
|
Hi all,
I have a webservice to which a client will send up several attachments using DIME and a WebMethod call, which could reach no more than 20mb. I understand that on the server I will either need to update the machine.config or the web.config to increase the maxRequestLength.
I also have the ability through the client app, to call a WebMethod which attaches files using DIME, and the client can then retrieve them. At the moment I'm having a difficulty replicating this, so I was just curious if there needs to be a maxRequestLength fields modified for the application (myapp.exe.config)? or in some other area?
Thanx
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
The maxRequestLength parameter has to be set in your webservice.
In your web.config you can add the following line under the system.web tag
<br />
<httpRuntime executionTimeout="90" maxRequestLength="4096" <br />
useFullyQualifiedRedirectUrl="false" minFreeThreads="8" <br />
minLocalRequestFreeThreads="4" appRequestQueueLimit="100" <br />
enableVersionHeader="true"/><br />
maxRequestLength is the maximum size allowed in KB
Hope it helps
|
|
|
|
|
Thank you Asad..
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
Hi Asad,
Something else i've noticed, is that WSE has its own limitations.
Therefore I had to add the following :
<br />
<microsoft.web.services2><br />
<messaging><br />
<maxRequestLength><br />
262144<br />
</maxRequestLength><br />
</messaging><br />
</microsoft.web.services2><br />
Cheers
Jubjub
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|