Click here to Skip to main content
15,904,638 members
Home / Discussions / C#
   

C#

 
GeneralRe: combobox.DataSource VS DataGrid.DataSource Pin
V.3-May-06 21:46
professionalV.3-May-06 21:46 
Questionpublic int CurrentRowIndex { get; set; } Pin
Rmokkenstorm3-May-06 2:24
Rmokkenstorm3-May-06 2:24 
Questionhow to set the browser shortcuts to our owm browser application Pin
ranandbe3-May-06 2:22
ranandbe3-May-06 2:22 
AnswerRe: how to set the browser shortcuts to our owm browser application Pin
Travis D. Mathison3-May-06 3:20
Travis D. Mathison3-May-06 3:20 
GeneralRe: how to set the browser shortcuts to our owm browser application Pin
ranandbe3-May-06 18:54
ranandbe3-May-06 18:54 
GeneralRe: how to set the browser shortcuts to our owm browser application Pin
Travis D. Mathison3-May-06 20:25
Travis D. Mathison3-May-06 20:25 
QuestionHow to connect to Sql and ole with password ? Pin
hdv2123-May-06 2:12
hdv2123-May-06 2:12 
AnswerRe: How to connect to Sql and ole with password ? Pin
Shajeel3-May-06 2:28
Shajeel3-May-06 2:28 
Questiondatagird/com_box Pin
Amalarajan3-May-06 1:58
Amalarajan3-May-06 1:58 
AnswerRe: datagird/com_box Pin
goyal manish3-May-06 2:09
goyal manish3-May-06 2:09 
QuestionHow to call a Page as an object in a method?? Pin
ryanchopps3-May-06 0:50
ryanchopps3-May-06 0:50 
AnswerRe: How to call a Page as an object in a method?? Pin
Guffa3-May-06 3:42
Guffa3-May-06 3:42 
GeneralRe: How to call a Page as an object in a method?? Pin
ryanchopps3-May-06 4:03
ryanchopps3-May-06 4:03 
AnswerRe: How to call a Page as an object in a method?? Pin
Guffa3-May-06 11:22
Guffa3-May-06 11:22 
QuestionHow to Connect to Dominos server from MS Outlook?? Pin
Bijon Roy3-May-06 0:43
Bijon Roy3-May-06 0:43 
AnswerRe: How to Connect to Dominos server from MS Outlook?? Pin
Daniele Ferrero3-May-06 4:20
Daniele Ferrero3-May-06 4:20 
QuestionHow to call a Page as an object in a method?? Pin
ryanchopps3-May-06 0:39
ryanchopps3-May-06 0:39 
AnswerRe: How to call a Page as an object in a method?? Pin
alexey N3-May-06 0:45
alexey N3-May-06 0:45 
GeneralRe: How to call a Page as an object in a method?? Pin
ryanchopps3-May-06 3:32
ryanchopps3-May-06 3:32 
QuestionHow to handle the mouse pointer using c# Pin
ranandbe3-May-06 0:06
ranandbe3-May-06 0:06 
AnswerRe: How to handle the mouse pointer using c# Pin
alexey N3-May-06 0:31
alexey N3-May-06 0:31 
AnswerRe: How to handle the mouse pointer using c# Pin
ranandbe3-May-06 0:37
ranandbe3-May-06 0:37 
QuestionHow to attach context menu to array of controls? Pin
Kranti12519842-May-06 23:30
Kranti12519842-May-06 23:30 
Hi,

I'm writing an application in c#.net, in which i've created array of control Button. I want to display a menu when user clicks any of the buttons in the array.

I was able to create context menu for a single button, but not for the array, as coded below ...

<br />
<br />
public class ButtonArray : System.Collections.CollectionBase<br />
{<br />
	private readonly System.Windows.Forms.Form ContainerControl;<br />
	public ButtonArray(System.Windows.Forms.Form Cont)<br />
	{<br />
		ContainerControl = Cont;<br />
	}<br />
	public void AddButton()<br />
	{<br />
		//code to create button  <br />
		btButton.MouseDown += new MouseEventHandler(btButton_MouseDown); <br />
	}<br />
	public void btButton_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)<br />
	{<br />
		contextMenuStudInfo = new System.Windows.Forms.ContextMenu();<br />
<br />
		System.Windows.Forms.MenuItem menuItem1;<br />
		menuItem1 = new System.Windows.Forms.MenuItem();<br />
		System.Windows.Forms.MenuItem menuItem2;<br />
		menuItem2 = new System.Windows.Forms.MenuItem();<br />
		contextMenuStudInfo.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { 					menuItem1, menuItem2 });<br />
<br />
		menuItem1.Index = 0;<br />
		menuItem1.Text = "Mark Present";<br />
		menuItem2.Index = 1;<br />
		menuItem2.Text = "Mark Absent";<br />
		<br />
		this.btButton.ContextMenu = contextMenuStudInfo;<br />
	}<br />
}                                <br />


how to attach the context menu to each member of button control array?

Thanks,
Kranti

-- modified at 5:31 Wednesday 3rd May, 2006
QuestionHow to get font from a winForm control of another application? Pin
snowborderjiang2-May-06 23:23
snowborderjiang2-May-06 23:23 
AnswerRe: How to get font from a winForm control of another application? Pin
alexey N2-May-06 23:28
alexey N2-May-06 23:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.