Click here to Skip to main content
15,917,964 members
Home / Discussions / C#
   

C#

 
GeneralRe: Datagrids - Selecting Rows Pin
Heath Stewart5-Aug-03 5:34
protectorHeath Stewart5-Aug-03 5:34 
Generalcom object, [out] params (pointers to values), C# Pin
alma4-Aug-03 1:55
alma4-Aug-03 1:55 
GeneralRe: com object, [out] params (pointers to values), C# Pin
Alexander Kojevnikov4-Aug-03 2:56
Alexander Kojevnikov4-Aug-03 2:56 
GeneralRe: com object, [out] params (pointers to values), C# Pin
alma4-Aug-03 3:17
alma4-Aug-03 3:17 
GeneralRe: com object, [out] params (pointers to values), C# Pin
Alexander Kojevnikov4-Aug-03 3:27
Alexander Kojevnikov4-Aug-03 3:27 
GeneralRe: com object, [out] params (pointers to values), C# Pin
alma4-Aug-03 3:56
alma4-Aug-03 3:56 
GeneralReferencing a reference Pin
Martin Cross3-Aug-03 23:22
Martin Cross3-Aug-03 23:22 
GeneralRe: Referencing a reference Pin
Furty4-Aug-03 0:46
Furty4-Aug-03 0:46 
It's hard to help with a code sample, but here's some code from a quick form I threw together which I hope shows how to do what you want.

using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
<br />
namespace ReferenceAReference<br />
{<br />
	/// <summary><br />
	/// Summary description for Form1.<br />
	/// </summary><br />
	public class Form1 : System.Windows.Forms.Form<br />
	{<br />
		private MyCustomObjectCollection myCustomObjectCollection;<br />
		private System.Windows.Forms.Button button1;<br />
		private System.Windows.Forms.TextBox textBox1;<br />
<br />
		/// <summary><br />
		/// Required designer variable.<br />
		/// </summary><br />
		private System.ComponentModel.Container components = null;<br />
<br />
		public Form1()<br />
		{<br />
			InitializeComponent();<br />
			this.myCustomObjectCollection = new MyCustomObjectCollection();<br />
<br />
			// fill the form with some textboxes<br />
<br />
			for(int x=0; x < 3; x++)<br />
			{<br />
				for(int y=0; y < 7; y++)<br />
				{<br />
					TextBox tb = new TextBox();<br />
					tb.Location = new Point(8 + (x*108), 8 + (y*24));<br />
					this.Controls.Add(tb);<br />
					this.myCustomObjectCollection.Add(new MyCustomObject(tb, null));<br />
				}<br />
			}<br />
		}<br />
<br />
		/// <summary><br />
		/// Clean up any resources being used.<br />
		/// </summary><br />
		protected override void Dispose( bool disposing )<br />
		{<br />
			if( disposing )<br />
			{<br />
				if (components != null) <br />
				{<br />
					components.Dispose();<br />
				}<br />
			}<br />
			base.Dispose( disposing );<br />
		}<br />
<br />
		#region Windows Form Designer generated code<br />
		/// <summary><br />
		/// Required method for Designer support - do not modify<br />
		/// the contents of this method with the code editor.<br />
		/// </summary><br />
		private void InitializeComponent()<br />
		{<br />
			this.button1 = new System.Windows.Forms.Button();<br />
			this.textBox1 = new System.Windows.Forms.TextBox();<br />
			this.SuspendLayout();<br />
			// <br />
			// button1<br />
			// <br />
			this.button1.Location = new System.Drawing.Point(112, 240);<br />
			this.button1.Name = "button1";<br />
			this.button1.Size = new System.Drawing.Size(112, 23);<br />
			this.button1.TabIndex = 0;<br />
			this.button1.Text = "Fill TextBoxes";<br />
			this.button1.Click += new System.EventHandler(this.button1_Click);<br />
			// <br />
			// textBox1<br />
			// <br />
			this.textBox1.Location = new System.Drawing.Point(8, 240);<br />
			this.textBox1.Name = "textBox1";<br />
			this.textBox1.TabIndex = 1;<br />
			this.textBox1.Text = "Test String";<br />
			// <br />
			// Form1<br />
			// <br />
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
			this.ClientSize = new System.Drawing.Size(464, 266);<br />
			this.Controls.AddRange(new System.Windows.Forms.Control[] {<br />
																		  this.textBox1,<br />
																		  this.button1});<br />
			this.Name = "Form1";<br />
			this.Text = "Form1";<br />
			this.ResumeLayout(false);<br />
<br />
		}<br />
		#endregion<br />
<br />
		/// <summary><br />
		/// The main entry point for the application.<br />
		/// </summary><br />
		[STAThread]<br />
		static void Main() <br />
		{<br />
			Application.Run(new Form1());<br />
		}<br />
<br />
		private void button1_Click(object sender, System.EventArgs e)<br />
		{<br />
			foreach(MyCustomObject o in this.myCustomObjectCollection)<br />
			{<br />
				o.TextBox.Text = this.textBox1.Text;<br />
			}<br />
		}<br />
	}<br />
<br />
	public class MyCustomObject<br />
	{<br />
		private System.Windows.Forms.TextBox textBox;<br />
		private object someObject;<br />
<br />
		public System.Windows.Forms.TextBox TextBox<br />
		{<br />
			get { return this.textBox; }<br />
			set { this.textBox = value; }<br />
		}<br />
<br />
		public object SomeObject<br />
		{<br />
			get { return this.someObject; }<br />
			set { this.someObject = value; }<br />
		}<br />
<br />
		public MyCustomObject(System.Windows.Forms.TextBox textBox, object someObject)<br />
		{<br />
			this.textBox = textBox;<br />
			this.someObject = someObject;<br />
		}<br />
	}<br />
<br />
<br />
	public class MyCustomObjectCollection : CollectionBase<br />
	{<br />
		public MyCustomObject Add(MyCustomObject value)<br />
		{<br />
			base.List.Add(value as object);<br />
			return value;<br />
		}<br />
<br />
		public void AddRange(MyCustomObject[] values)<br />
		{<br />
			foreach(MyCustomObject item in values)<br />
				Add(item);<br />
		}<br />
<br />
		public void Remove(MyCustomObject value)<br />
		{<br />
			base.List.Remove(value as object);<br />
		}<br />
<br />
		public void Insert(int index, MyCustomObject value)<br />
		{<br />
			base.List.Insert(index, value as object);<br />
		}<br />
<br />
		public bool Contains(MyCustomObject value)<br />
		{<br />
			foreach(object o in base.List)<br />
				if (value.Equals(o))<br />
					return true;<br />
			return false;<br />
		}<br />
<br />
		public bool Contains(MyCustomObjectCollection values)<br />
		{<br />
			foreach(MyCustomObject t in values)<br />
			{<br />
				if (Contains(t))<br />
					return true;<br />
			}<br />
<br />
			return false;<br />
		}<br />
<br />
		public MyCustomObject this[int index]<br />
		{<br />
			get { return (base.List[index] as MyCustomObject); }<br />
			set { base.List[index] = value; }<br />
		}<br />
<br />
		public int IndexOf(MyCustomObject value)<br />
		{<br />
			return base.List.IndexOf(value);<br />
		}<br />
	}<br />
}

GeneralRe: Referencing a reference Pin
Martin Cross4-Aug-03 0:55
Martin Cross4-Aug-03 0:55 
GeneralRe: Referencing a reference Pin
Furty4-Aug-03 9:16
Furty4-Aug-03 9:16 
GeneralRe: Referencing a reference Pin
Martin Cross4-Aug-03 22:13
Martin Cross4-Aug-03 22:13 
GeneralRe: Referencing a reference Pin
Furty5-Aug-03 1:02
Furty5-Aug-03 1:02 
GeneralRe: Referencing a reference Pin
Martin Cross5-Aug-03 3:07
Martin Cross5-Aug-03 3:07 
GeneralRe: Referencing a reference Pin
Furty5-Aug-03 14:10
Furty5-Aug-03 14:10 
GeneralRe: Referencing a reference Pin
Heath Stewart4-Aug-03 6:11
protectorHeath Stewart4-Aug-03 6:11 
GeneralRe: Referencing a reference Pin
Martin Cross4-Aug-03 6:24
Martin Cross4-Aug-03 6:24 
GeneralRe: Referencing a reference Pin
Heath Stewart4-Aug-03 6:34
protectorHeath Stewart4-Aug-03 6:34 
QuestionHow to get system-wide cursor status in c#? Pin
CyberKewl3-Aug-03 22:02
CyberKewl3-Aug-03 22:02 
AnswerRe: How to get system-wide cursor status in c#? Pin
J. Dunlap3-Aug-03 22:34
J. Dunlap3-Aug-03 22:34 
GeneralRe: How to get system-wide cursor status in c#? Pin
CyberKewl4-Aug-03 4:25
CyberKewl4-Aug-03 4:25 
GeneralAbout some syntax Pin
FlyingDancer3-Aug-03 21:40
FlyingDancer3-Aug-03 21:40 
GeneralRe: About some syntax Pin
Alexander Kojevnikov3-Aug-03 22:41
Alexander Kojevnikov3-Aug-03 22:41 
GeneralRe: About some syntax Pin
FlyingDancer3-Aug-03 23:03
FlyingDancer3-Aug-03 23:03 
GeneralRe: About some syntax Pin
Alexander Kojevnikov4-Aug-03 2:42
Alexander Kojevnikov4-Aug-03 2:42 
GeneralRe: About some syntax Pin
FlyingDancer4-Aug-03 2:55
FlyingDancer4-Aug-03 2:55 

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.