Click here to Skip to main content
15,905,967 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGrid Issue Please HELP Pin
Christian Graus19-Sep-05 14:34
protectorChristian Graus19-Sep-05 14:34 
GeneralRe: DataGrid Issue Please HELP Pin
Taurian11019-Sep-05 17:01
Taurian11019-Sep-05 17:01 
GeneralRe: DataGrid Issue Please HELP Pin
Christian Graus19-Sep-05 18:15
protectorChristian Graus19-Sep-05 18:15 
GeneralRe: DataGrid Issue Please HELP Pin
Taurian11019-Sep-05 18:39
Taurian11019-Sep-05 18:39 
QuestionProblem with this function.. Pin
Yannielsen19-Sep-05 10:19
Yannielsen19-Sep-05 10:19 
AnswerRe: Problem with this function.. Pin
Christian Graus19-Sep-05 11:37
protectorChristian Graus19-Sep-05 11:37 
AnswerRe: Problem with this function.. Pin
miah alom19-Sep-05 11:38
miah alom19-Sep-05 11:38 
GeneralRe: Problem with this function.. Pin
Yannielsen19-Sep-05 12:23
Yannielsen19-Sep-05 12:23 
The tempArray and ButtonArray comes from here in the main form

		<br />
ButtonArray btnArray;<br />
ButtonArray tempArray;<br />
<...><br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
btnArray = new ButtonArray(this);<br />
tempArray = new ButtonArray(this);<br />
}<br />


Both ButtonArrays come from this class

using System;<br />
<br />
namespace ButtonArray<br />
{<br />
	/// <summary><br />
	/// Summary description for ButtonArray.<br />
	/// </summary><br />
	public class ButtonArray : System.Collections.CollectionBase<br />
	{<br />
		private readonly System.Windows.Forms.Form HostForm;<br />
		<br />
		public System.Windows.Forms.Button AddNewButton()<br />
		{<br />
			// Create a new instance of the Button class.<br />
			System.Windows.Forms.Button aButton = new System.Windows.Forms.Button();<br />
			<br />
			// Add the button to the collection's internal list.<br />
			this.List.Add(aButton);<br />
			<br />
			// Add the button to the controls collection of the form <br />
			// referenced by the HostForm field.<br />
			HostForm.Controls.Add(aButton);<br />
			<br />
			// Set intial properties for the button object.<br />
			aButton.Top = Count * 25;<br />
			aButton.Left = 100;<br />
			aButton.Tag = this.Count;<br />
			aButton.Text = "Button " + this.Count.ToString();<br />
			<br />
<br />
			aButton.Click += new System.EventHandler(ClickHandler);<br />
			<br />
			return aButton;<br />
		}<br />
		public ButtonArray(System.Windows.Forms.Form host)<br />
		{<br />
			HostForm = host;<br />
			this.AddNewButton();<br />
		}<br />
		<br />
		public System.Windows.Forms.Button this [int Index]<br />
		{<br />
			get<br />
			{<br />
				return (System.Windows.Forms.Button) this.List[Index];<br />
			}<br />
			<br />
			set<br />
			{<br />
				this.List[Index] = value;<br />
			}<br />
		}<br />
		<br />
		public void RemoveX(int iRemoveX)<br />
		{<br />
			// Check to be sure there is a button to remove.<br />
			if (this.Count > 0)<br />
			{<br />
				// Remove the button indexed with the value of iRemoveX<br />
				HostForm.Controls.Remove(this[iRemoveX-1]);<br />
				this.List.RemoveAt(this.Count-1);<br />
			}<br />
		}<br />
		<br />
		public void RemoveButton()<br />
		{<br />
			// Check to be sure there is a button to remove.<br />
			if (this.Count > 0)<br />
			{<br />
				// Remove the last button added to the array from the host form <br />
				// controls collection. Note the use of the indexer in accessing <br />
				// the array.<br />
				HostForm.Controls.Remove(this[this.Count -1]);<br />
				this.List.RemoveAt(this.Count -1);<br />
			}<br />
		}<br />
		<br />
		public void FlushArray()<br />
		{<br />
			// Check to be sure there is a button to remove.<br />
			if (this.Count > 0)<br />
			{<br />
				for(int iButtonIndex = this.Count; iButtonIndex > 0; iButtonIndex--)<br />
				{<br />
					// Remove the button indexed with the value of iRemoveX<br />
					HostForm.Controls.Remove(this[iButtonIndex-1]);<br />
					this.List.RemoveAt(iButtonIndex-1);<br />
				}<br />
			}<br />
		}<br />
		<br />
		public void ClickHandler(Object sender, System.EventArgs e)<br />
		{<br />
			System.Windows.Forms.MessageBox.Show("You have clicked button " + <br />
				((System.Windows.Forms.Button) sender).Tag.ToString());<br />
		}<br />
	}<br />
}

QuestionFiltering Publisher ID with LCE (COM+) Pin
Fred dBu19-Sep-05 10:11
Fred dBu19-Sep-05 10:11 
QuestionC# and SQL database Pin
Drew McGhie19-Sep-05 9:46
Drew McGhie19-Sep-05 9:46 
AnswerRe: C# and SQL database Pin
Jim_Stanley19-Sep-05 13:54
Jim_Stanley19-Sep-05 13:54 
QuestionOverride Paint Method for DataGrid Pin
zaboboa19-Sep-05 9:41
zaboboa19-Sep-05 9:41 
AnswerRe: Override Paint Method for DataGrid Pin
Dave Kreskowiak19-Sep-05 12:53
mveDave Kreskowiak19-Sep-05 12:53 
GeneralRe: Override Paint Method for DataGrid Pin
zaboboa20-Sep-05 1:48
zaboboa20-Sep-05 1:48 
QuestionProblem with ByValue Parameters Pin
Seraphin19-Sep-05 8:24
Seraphin19-Sep-05 8:24 
AnswerRe: Problem with ByValue Parameters Pin
KaptinKrunch19-Sep-05 8:38
KaptinKrunch19-Sep-05 8:38 
GeneralRe: Problem with ByValue Parameters Pin
Seraphin19-Sep-05 8:48
Seraphin19-Sep-05 8:48 
GeneralRe: Problem with ByValue Parameters Pin
KaptinKrunch19-Sep-05 8:53
KaptinKrunch19-Sep-05 8:53 
GeneralRe: Problem with ByValue Parameters Pin
Seraphin19-Sep-05 9:10
Seraphin19-Sep-05 9:10 
GeneralBad solution - copy objects Pin
Seraphin19-Sep-05 9:19
Seraphin19-Sep-05 9:19 
GeneralRe: Bad solution - copy objects Pin
tommazzo19-Sep-05 10:36
tommazzo19-Sep-05 10:36 
QuestionC# reference parameter Pin
Csupor Jenő19-Sep-05 7:32
Csupor Jenő19-Sep-05 7:32 
AnswerRe: C# reference parameter Pin
Dave Kreskowiak19-Sep-05 8:34
mveDave Kreskowiak19-Sep-05 8:34 
GeneralRe: C# reference parameter Pin
Csupor Jenő19-Sep-05 8:51
Csupor Jenő19-Sep-05 8:51 
GeneralRe: C# reference parameter Pin
Dave Kreskowiak19-Sep-05 9:28
mveDave Kreskowiak19-Sep-05 9: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.