I am adding a grid of command buttons to a user control. I am having trouble adding the tooltiptext at runtime. I have a tooltip control added to the user control form. Here is the code where I want to add it:
thxCode:int x=0,y=0; p_socks=new Button[iX,iY]; try { for(x=0;x<iX;x++) { for(y=0;y<iY;y++) { //set socket's back color to default backcolor; //p_sockColor[x,y]=p_defaultColor; //no need to create sockets again if(socketsCreated) return true; //generate socket name string butName=x.ToString()+(char)(y+'A'); //add new buttons p_socks[x,y]=new Button(); this.Controls.Add(p_socks[x,y]); p_socks[x,y].Location = new System.Drawing.Point(10, 10); p_socks[x,y].Name = "butX"+x+"Y"+y; p_socks[x,y].Size = new System.Drawing.Size(20, 20); p_socks[x,y].TabIndex = 20; p_socks[x,y].Click+=new System.EventHandler(sockClickHand); //p_socks[x,y].tooltip???????????????? } } this.Refresh(); return true; }




Reply With Quote