|
You will need to write a recursive method which iterates through all nodes of your treeview and checks if the node you are adding is present or not.
|
|
|
|
|
thank you i have written a recursive method and it is working but slow ...
i was looking for a simple method..
*** Why EXPERTS behave like a fool ***
|
|
|
|
|
What do you mean by simple? I don't think there is any other way rather then using a recursive function, you can just try to optimize it.
You could also maintain a HashTable or Dictionary variable where you will store all nodes that you add and check whether the node you are adding is already present but in that case your application will need more memory. If performance is your priority you can do it but if your priority is memory usage then you should go with recursive function. It depends on the situation.
|
|
|
|
|
quite simple...use
treeView1.Nodes.Find()
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Good Day,
Say I have a simple application that copies files to another folder and I'm using File.Copy to recursively copy the file.
Is there a way to query the the progress of the File.Copy method?
Thanks!
|
|
|
|
|
Google not working for you? Here are results from a simple search: Google[^]
|
|
|
|
|
use Background Worker
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
can anyone please help me out in writing a code in c# for playing .mp3 files
thx. in advance
|
|
|
|
|
You can use the windows media player control, or managed DirectX for this.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Get It.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace audio1
{
public partial class Form1 : Form
{
private string Pcommand;
private bool isOpen;
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand,StringBuilder strReturn,int iReturnLength, IntPtr hwndCallback);
public void Close()
{
Pcommand = "close MediaFile";
mciSendString(Pcommand, null, 0, IntPtr.Zero);
isOpen=false;
}
public void Open(string sFileName)
{
Pcommand = "open \"" + sFileName + "\" type mpegvideo alias MediaFile";
mciSendString(Pcommand, null, 0, IntPtr.Zero);
isOpen = true;
}
public void Play(bool loop)
{
if(isOpen)
{
Pcommand = "play MediaFile";
if (loop)
Pcommand += " REPEAT";
mciSendString(Pcommand, null, 0, IntPtr.Zero);
}
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "|*.mp3";
openFileDialog1.ShowDialog();
textBox1.Text = openFileDialog1.FileName;
Open(textBox1.Text);
}
private void button2_Click(object sender, EventArgs e)
{
Play(false);
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}
|
|
|
|
|
Hello
I have a datatable in a dataset used as datasource by a datagridviewrow
dgv.DataSource=ds.Tables[0];
now having a row in the datagridviewrow I need to acceed the related row in the datatable
Of course the ordinal indice can't be used because the dgv can be sorted, rows deleted etc..
For now I didn't find any simple way and I browse all the Table in a loop to get a row based on a Cell value
It seems a little hard
I also try this but it doesn't work ??
DataRow dr = (DataRow)dgv_addr.Rows[n].DataBoundItem;
|
|
|
|
|
hi friends
i need a very simple compiler that created by visual c# for my undergraduate compiler course project and i also need a source of that compiler!!!! please help me!
tanx alot
|
|
|
|
|
You want a compiler written in C# ? Isn't that a little redundant ? I'm sorry, we don't do peoples course assignments for them.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Try it your self !!!! when enver you stuck you can ask here !!! no body will provide the code !!!!!
Good luck !!!
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
I have a Textbox and have a validation that textbox should not be empty,now when form loads it got focus, if i want to close the Form through form close button that is upper right side of form, it doesnot allow me to close the form bcoz validation gets called.
It is in C# windows.
How can i do that?????????
|
|
|
|
|
Use ValidationGroup with validation controls and the button for submit(insert or update) and don't give validationGroup to cancel button
Best Regards,
Chetan Patel
|
|
|
|
|
how you are using validation for that text box ?
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
I'm sure this must be a solved problem, but I really don't know what keywords to use, because I have no idea how to approach it without some kind of unmanaged callback hackery. So, it's basically this: I need to send emails through a gmail account from my C# program. This basically means there will be strings inside my source that contain the gmail username and password.
This is obviously bad, in the presence of Reflector. In the unmanaged world we could encrypt the strings using some encryption algorithm, and since the details of the encryption algorithm would be compiled to assembly nobody could tell what's going on. But in the managed world, the details of such an encrypting process are there for everyone to decompile, so it doesn't sound like that's going to work.
Thoughts?
-Domenic Denicola-
|
|
|
|
|
There's no solution to this, even if you hide the username/password in a C++ dll, your C# code would show the process of getting your hands on it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Why would you hardcode the passwords in anyway?
Surely it would be better to store them in the application settings, scoped per user?
|
|
|
|
|
Because it's the application which needs to send emails, not the user. E.g. crash reporting emails or some such.
It looks like the solution does have to do with appSettings though; I'm not quite clear why it works (i.e. why can't I just rename hisprogram.config to myprogram.config, and in myprogram.exe run the code that reflector shows me is necessary to retrieve the setting), but apparently it does. I think.
-Domenic Denicola-
|
|
|
|
|
Hello friends,
I am developing an windows application using C#.NET and i am facing a problem in Copy to clipboard.
I want to copy label along with its caption as a image and that can be paste to MS word..
So how can i do that....
Thanks
|
|
|
|
|
A label IS a caption, isn't it ? So, I guess you can either use the label's DrawToBitmap method or some other way to create a bitmap, if you must have a bitmap, not a string, and then put that in the clipboard.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|