How to call a comboBox1_SelectedIndexChanged(object sender, EventArgs e) method from this code:

private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
	{		
		// Get subdirectories from disk, add to treeView1 control
		AddDirectories(e.Node);		

		// if node is collapsed, expand it. This allows single click to open folders.
		treeView1.SelectedNode.Expand();			
		
		// Get files from disk, add to listView1 control
                //IT SHOULD BE HERE!!!
		AddFiles(e.Node.FullPath.ToString());
		statusBar1.Text = iDirectories.ToString() + " Folder(s)  " + iFiles.ToString() + " File(s)";
	}

I have a code there which will Add selected files.

Recommended Answers

All 2 Replies

Hello.
All you need is decide what objects to pass to that method and then - call it. E.g.:

comboBox1_SelectedIndexChanged(comboBox1, new EventArgs());

If you set the comboBox1.SelectedIndex to a value, it will call the event handler automagically...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.