|
i thought you wanted to exclude the root node, that is the initial root node.
you should just be adding to it with your recursive call like
rootNode.Nodes.Add(GetSubTree());
if you want the root, the easiest way is to code it and hold a reference to it
... or ...
get it from tree.Nodes collection
hth
g00fy
|
|
|
|
|
Thanks for the speedy response. You were right, I want to exclude the topnode or root node. I want to make changes to all of the child nodes, not the topnode. How will adding the GetSubTree exclude the topnode? Thanks again for all of your help.
|
|
|
|
|
get subtree is your recursive call that is building the subtree/s then you add that to the node collection of the rootnode
just a quick eg of top of head
<br />
private TreeNode root;<br />
<br />
public void Test()<br />
{<br />
<br />
root = new TreeNode("root");<br />
<br />
root.Nodes.Add(GetSubTree());<br />
this.treeView1.Nodes.Add(root);<br />
}<br />
<br />
int i = 0;<br />
private TreeNode GetSubTree()<br />
{ <br />
TreeNode subtree = new TreeNode("x: " + i);<br />
<br />
while(i++ < 10)<br />
{<br />
root.Nodes.Add(new TreeNode("node: " + i));<br />
return GetSubTree(); <br />
}<br />
<br />
return subtree;<br />
}<br />
hth
g00fy
|
|
|
|
|
Thanks for your help Goofy. Have a good one.
|
|
|
|
|
no problem,
hopefully i was some help
regards,
g00fy
|
|
|
|
|
hi to all,
does anyone know why this is not working for me, if have searched hi and low to get the constants (btw, is there an easy way to inspect dll to get constants ?) and i have come up with this but it doesnt scroll, i only want to scroll horizontally, single line, to make sure i can left / right scroll through textbox over/under flow
<br />
private const int WM_HSCROLL = 276;
private const int WM_VSCROLL = 277;
private const int SB_LINEUP = 0;
private const int SB_LINELEFT = 0;
private const int SB_LINEDOWN = 1;
private const int SB_LINERIGHT = 1;
private const int SB_PAGEUP = 2;
private const int SB_PAGELEFT = 2;
private const int SB_PAGEDOWN = 3;
private const int SB_PAGERIGTH = 3;
private const int SB_PAGETOP = 6;
private const int SB_LEFT = 6;
private const int SB_PAGEBOTTOM = 7;
private const int SB_RIGHT = 7;
private const int SB_ENDSCROLL = 8;
<br />
<br />
[DllImport("user32.dll", CharSet=CharSet.Auto)]<br />
private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);<br />
<br />
<br />
private void btnScrollLeft_Click(object sender, System.EventArgs e)<br />
{<br />
SendMessage(this.textBox.Handle, WM_HSCROLL, (IntPtr)SB_LINELEFT, IntPtr.Zero);<br />
}<br />
any help would be excellent,
thank you
g00fy
|
|
|
|
|
textBox1.SelectionStart = 0;
textBox1.ScrollToCaret();
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thanks for speedy reply Christian, but that will just scroll to end of line left or right, i wanted to scroll char at a time either way.
i got it sorted anyway, in all my attempts i inadvertantly set scrollbars to none on the textbox, so its working now
however, i have reduced the size of the textbox so you cannot see the scrollbar and am using custom buttons at either end depending on which side is overflowed.
the question,
can i completely hide the scrollbar, because there is still a 2 pixel scrollbar under the textbox, and my form colour really makes it standout ?
kind regards,
g00fy
|
|
|
|
|
I doubt you can hide it. I think a variation on the code I showed you is the way to go, you can scroll to where-ever you like, by selecting it first.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thank you for speedy responses,
i will go with your idea
kind reagrds,
g00fy
|
|
|
|
|
how to create create an extension function in c# that returns a value similar to xalan:nodeset
kavitha
|
|
|
|
|
I have the following code:
this.providersAdapter = new SqlDataAdapter("SELECT * FROM Providers", this.dbCon);
this.providersTable = new DataTable();
providersAdapter.Fill(this.providersTable);
When I run this code, an exception occurs on the line marked above, it says
An unhandled exception of type System.Data.SqlCliend.SqlException occured in System.data.dll
Additional Information: System error.
it's driving me crazy, any information is highly appreciated...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
Hi all,
How can I create a custom component that can be
drawn from the toolbox in vs studio which can be visualized
in the design form ? When I extend an windows forms control, but it
can't be shown on the design form in the vs studio .net ?
Thanks
|
|
|
|
|
You might need to create some design for that or can extend existing design class. To do this you need to provide some attribute values.
hope this helps
- ashish
|
|
|
|
|
Following is the code I am using...
<br />
protected override void DoDiscoverParameters(char parameterToken)<br />
{<br />
this.parameterToken = parameterToken;<br />
using (IfxCommand newCommand = CreateNewCommandAndConnectionForDiscovery())<br />
{<br />
IfxCommandBuilder.DeriveParameters(newCommand);<br />
<br />
foreach (IDataParameter parameter in newCommand.Parameters)<br />
{<br />
IDataParameter cloneParameter = (IDataParameter)((ICloneable)parameter).Clone();<br />
cloneParameter.ParameterName = BuildParameterName(cloneParameter.ParameterName);<br />
this.command.Parameters.Add(cloneParameter);<br />
}<br />
newCommand.Connection.Close();<br />
}<br />
}
There I get the error saying "Specified cast is not valid." only for informix. I am creating Enterprise Library for Informix using IBM .NET informix libraries.
Please help.
- ashish
|
|
|
|
|
Hello
I have a javascript that hides controls on a page depending on a few settings. At the moment I only call this script from the Page's Body_OnLoad event. The problem is I have a ASP:Button with autopostback = true, and when this is pushed all the controls that were hidden by the javascript suddenly appears. Where do I call the javascript to run it after every server request?
/Regards Magnus
|
|
|
|
|
Why can't you set the visible property on the server ? Otherwise, use RegisterClientScriptBlock to put the code in there every time.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thanks alot!
Actually I could use the .visible on server, but its quite alot to hide, and I already have the javscript ready so I'd prefer to call that. Also, I was interested in how one would go about doing it the other way
edit: and I also get "object required" if I hide with .visible on server and after that fire up the javascript.
-- modified at 7:29 Tuesday 27th September, 2005
|
|
|
|
|
Hi,
I'm trying to use the enter key on the pocket pc keyboard. Is there anyway that I can click on the enter key on the pocket pc keyboard to execute anything?
|
|
|
|
|
put this in you constructor code:
this.Enter += new System.EventHandler(this.MainForm_Enter);
And this to handle the event:
private void MainForm_Enter(object sender, System.EventArgs e)
{
//put any code here to handle the enter key
}
Cheers.
|
|
|
|
|
Hi
i have code like this:
else if (dane[0]==komunikat.PLPobierzRekord)<br />
{<br />
BinaryFormatter bf = new BinaryFormatter();<br />
MemoryStream ms=new MemoryStream();<br />
bf.Serialize(ms,Poldane[0]);<br />
byte[] buffer = ms.ToArray();<br />
<br />
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();<br />
byte[] bajt=encoding.GetBytes(komunikat.PLZwrocRekord);<br />
byte[] dana=new byte[bajt.Length+buffer.Length];<br />
for (int a=0;a<buffer.Length;a++)<br />
{<br />
•1 dana[a+bajt.Length+1]=buffer[a];<br />
}<br />
for (int a=0;a<bajt.Length;a++)<br />
{<br />
•2 dana[a]=bajt[a];<br />
}<br />
<br />
dana[bajt.Length]=149;<br />
<br />
•3 MessageBox.Show(this,"a");<br />
}<br />
where
•1, •2, •3 - breakpoint
And here is a surprise... breakpoint 1 and 2 work and visual studio stop on this point but never stop obn breakpoint number 3. Why?? When i trace program step by step last step is before breakpoint 3 and program leave this else if block?!
Greetings
|
|
|
|
|
Did you add this code recently ? Have you tried a rebuild all ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
i rebuid all... and nothing change... but i found an error i code... i try set element in array bigger then declared array... but i don't know why program don't return error?!
Greetings
|
|
|
|
|
Maybe you were writing onto the null terminator ?
Anyhow, if the breakpoint is not stopped, and the code is not called, then you're not running the code you're building, one way or the other. I don't know why.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi!
I guess the line before the breakpoint throws an exception that's not being caught.
This could be the reason why the breakpoint is never reached.
Regards,
mav
|
|
|
|