|
Hi,
I'm adding TreeView nodes in the following way:
<br />
foreach (System.IO.DirectoryInfo di in dirs) {<br />
inTreeNode.Nodes.Add(new TreeNode(di.Name));<br />
<br />
...<br />
}<br />
But now i want to put custom icon, so i added a ImageList and i searched for the overloaded method which permits me to select the icon index:
<br />
inTreeNode.Nodes.Add(new TreeNode(di.Name));<br />
inTreeNode.Nodes.Add(di.Name, di.Name, this.folderIndex);<br />
The thing is that the overloaded method doesnt accept a TreeNode as parameter, so i have first created the node and then made the association with the image index i want.
This didnt worked as now i have two copies of the same node with different icons. How can i solve this?
Thx,
Nuno
|
|
|
|
|
it clearly _does_ accept TreeNode as a paramter.
try this:
TreeNode tn = new TreeNode(di.name);<br />
tn.ImageIndex = ...;<br />
inTreeNode.Nodes.Add(tn);
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
I was just exploring that option!!
I now discovered other problem.
When i select a item in the tree, it stays with the first image list index, even when i have already defined a index for it. Is this normal?
Thx for your help in the other thread, the treeview its working!
Nuno
|
|
|
|
|
No problem and I'd like to continue to help you, but I don't understand the problem. Can you rephrase it, maybe with some code samples?
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
I cant show code sample for this problem.
When i run up, everything is fine. The tree is filled up and the file types which have a special icon are set up.
However, when i select an item in the tree, the icon changes to other icon, in this case, the first icon i have in my image list.
Was i clear now?
Thx,
Nuno
|
|
|
|
|
Yes, very
you should use SelectedImageIndex
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
Its perfect now!
Thx a lot!
Nuno
|
|
|
|
|
Hi,
I am extending the Generic list class for defining my own methods like
Sum,Average,Min and Max for the collection.Here i want to make my collection
access in Thread safe manner. i.e. when one threading is accessing the
collection for finding the sum or clearing the collection other Threads
should not be able to access it.i dont think lock is the best way to do so.
If any one knows the better way of implementing synchronization, Please let
me know.
With Thanks,
Sakthi.
|
|
|
|
|
Why don't you think lock is the best way to go?
Thread safety is a matter of design as well as locking of crucial issues. One thing I do is to iterate over a shallow clone of collections rather than the actual collection allowing the collection to be thread-safe while someone else is iterating.
But then if the underlying objects are not thread-safe you still have the same problem. Basically, focus on Static Methods, decent design, and locking where appropriate and test. If you are not able to see threading in your head then you will have to hack at it. Many will say threading is a difficult concept to master.
File Not Found
|
|
|
|
|
i have crated a chatting application.
chatting workes well.
but when the form is minimized. i could not get the new message. each time i have to open and see.
how to do popup like other chatting application?
thank u
|
|
|
|
|
I think this is what you're looking for:
ADSS Tray Popup Window
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
hello all,
does anybody know how to set the contextmenustrip position (programatically) when the user press the "menu" button on the keyboard (near Alt Gr. or Win btn) ?
thanks
VirtualVoid.NET
|
|
|
|
|
The contextmenustrip has a method Show with several overloads. Some of them take the screen coordinates of the top left corner of the context menu....
|
|
|
|
|
i have created a windows application .
with the use of WMI i could start/stop process at the remote system
the newly created process show in the task bar but not popups like local system
thank u
|
|
|
|
|
If you read the documentation on the Win32_Process WMI class, it tells you, in bolded text, that you can NOT create an interactive process on a remote machine using WMI.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thank u sir.
is there any other way to do this
|
|
|
|
|
PSEXEC[^]
The only problem with using this thing is that most virus scaning software will flag it as an unwanted program.
What you want to do is very difficult to get away with simply because it's a HUGE security risk to allow any kind of remote code execution.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Hello there CP experts,
I don't really know what its called but I would like to create my own common tasks editor for my control.
By common tasks editor I mean the square window you can open by clicking the small button with the arrow pointing right, which is located in the upper right corner of the controls.
This window's title is always in the form of "<Control Type> Tasks" (e.g. "ListView Tasks").
I've inherited the ComboBox control in order to create an ImageCombo control.
What I want now is to create my own tasks editor and replace the old one that ComboBox defines...
Help...??
Thanks in advance,
Shy.
|
|
|
|
|
I have wrote an article that should be perfect for your situation, if you are talking about the design-time smart tags of VS. Targeting Design-Time Events of User Controls[^] gives you information to add smart tags during design-time to your custom controls and allows you to add interactivity to the design-time experience.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thanks! Looks really neat!
Regards,
Shy.
|
|
|
|
|
Hi,
i use DataSet method (writexml) to create an xml file.
in the table i have only "2005-10-3" and in the xml file
"2005-10-3:T00:00:00-2:00"
How to change this???????????
To many questions ? No, not enough answers!!!
|
|
|
|
|
I'm not sure, but I don't think you can actually change it because that would have to involve editing the WriteXML method, which you can't.
Is parsing it when you load the XML file again a solution to your problem?
You can use datatime.ToShortDateTime() and other methods.
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
I must create the xml in one fixed format.
I have create one bull s...t
I have create another table with string fields and with this i can write the exact format but it is not a good ideea. This s...t works but the method is ..... not for the coders.
<code>
DataRow row2 = tr.NewRow();
object[] vct = dataTemp.Rows[0].ItemArray;
for (int k = 0; k < vct.Length;k++ )
{
MessageBox.Show(vct[k].GetType().ToString());
if (vct[k].GetType().ToString() == "System.DateTime")
{
DateTime dtime = new DateTime();
dtime = Convert.ToDateTime(vct[k]);
row2[k] = dtime.ToString("yyyy-MM-dd");
}
else
row2[k] = vct[k].ToString(); </code>
|
|
|
|
|
1. you should use
for (int k = 0; k < vct.Length -1; k++)
2. try to use dtime.ToShortDateString or if you really need custom formatting I always prefer things like this:
dtime.Year + "-" + dtime.Month + "-" + dtime.Day
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|