I'm new to C#, I need to overwrite label on windows form. I'm generating number of labels as per value of n using loop.
The issue: if I change the value of lines[i] while running the program, the value does get changed but is not updated on windows form (previous value does not gets replaced by new one).
Can any one guide me how can I do that?
Also I'm refreshing the code every second using timer, which is also working fine
This is the part where I create the label and write the value in it, and it is in loop
Label label = new Label();
label.Text = String.Format("{0}", lines[i]);
label.Left = 10;
label.Top = (i + 1) * 25;
this.Controls.Add(label);
here is my complete code id anyone needs to check it:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace Admin
{
public partial class Form1 : Form
{
string pathuser = #"//192.168.2.10/Shared-Public/Users.txt";
int check = 0;
public static string usernam;
string[] lines = new String[500];
string[] lines2 = new String[500];
public Form1()
{
InitializeComponent();
}
private void timer_Tick(object sender, EventArgs e)
{
tc = tc + 1;
Console.WriteLine(tc);
int c = 2;
int u = 0;
int us = 0; //for user pass
int z = 0; // for reading values from file
using (StreamReader sr2 = new StreamReader(pathuser))
{
string line;
while ((line = sr2.ReadLine()) != null)
{
lines[us] = line;
us++;
}
}
for (int i = 0; i < us; i++)
{
//Create label
Label label = new Label();
label.Text = String.Format("{0}", lines[i]);
//Position label on screen
label.Left = 10;
label.Top = (i + 1) * 25;
Label label2 = new Label();
label2.Left = 120;
label2.Top = (i + 1) * 25;
string line2;
string path = "//192.168.2.10/Shared-Public/" + lines[i] + DateTime.Now.ToString(" MM-dd-yyyy") + ".txt";
if (!File.Exists(path))
{
lines2[z] = null;
}
else
{
using (StreamReader sr3 = new StreamReader(path))
{
while ((line2 = sr3.ReadLine()) != null)
{
lines2[z] = line2;
z++;
}
}
label2.Text = String.Format("{0}", lines2[0]);
u = z;
z = 0;
}
PictureBox picbox = new PictureBox();
picbox.Location = new Point(240, 25 + (i*25));
picbox.Size = new Size(15, 15);
if (u%2==0)
picbox.BackColor = Color.Green;
else
picbox.BackColor = Color.Red;
u = 0;
this.Controls.Add(label);
this.Controls.Add(label2);
this.Controls.Add(picbox);
}
}
int tc = 0;
private void Form1_Load(object sender, EventArgs e)
{
Timer timer = new Timer();
timer.Interval = (1000);
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
}
}
Give your label's Name a Unique id and Search for it and replace the value:
Label label = new Label();
var someid = new Guid().ToString();
label.Name = someid;
label.Text ="aaaa";
label.Left = 10;
this.Controls.Add(label);
foreach(Control item in this.Controls)
{
if (item.Name == someid)
item.Text = "bbb";
}
Related
I have a panel and on this panel, I create a number of TextBoxes, one under the other. The number of TextBoxes is greater than the vertical size of the panel can accommodate.
I have two problems:
1. The first TextBox appears at a large vertical distance from the top of the panel, even though its vertical coordinate is 5.
2. I want to automatically scroll to the bottom of the panel so that the last TextBoxes get visible, but I am unable to do that.
The first TextBoxes remain visible.
Here is the code I use:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TestPanelScroll
{
public partial class Form1 : Form
{
private const int _verticalSpacing = 1;
public Form1()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
this.BackColor = Color.BurlyWood;
this.ClientSize = new Size(800, 800);
this.SuspendLayout();
panelLeftForNodeCreationAndNodeMembersEditingMode = new Panel();
panelLeftForNodeCreationAndNodeMembersEditingMode.SuspendLayout();
panelLeftForNodeCreationAndNodeMembersEditingMode.Location = new Point(3, 56);
panelLeftForNodeCreationAndNodeMembersEditingMode.Size = new Size(461, 187);
panelLeftForNodeCreationAndNodeMembersEditingMode.Name = "panelLeftForNodeCreationAndNodeMembersEditingMode";
panelLeftForNodeCreationAndNodeMembersEditingMode.BorderStyle = BorderStyle.Fixed3D;
panelLeftForNodeCreationAndNodeMembersEditingMode.Visible = true;
panelLeftForNodeCreationAndNodeMembersEditingMode.CausesValidation = false;
panelLeftForNodeCreationAndNodeMembersEditingMode.TabStop = false;
panelLeftForNodeCreationAndNodeMembersEditingMode.TabIndex = 0;
panelLeftForNodeCreationAndNodeMembersEditingMode.BackColor = Color.LightGray;
panelLeftForNodeCreationAndNodeMembersEditingMode.SetAutoScrollMargin(0, 40);
panelLeftForNodeCreationAndNodeMembersEditingMode.HorizontalScroll.Maximum = 0;
panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScroll = false;
panelLeftForNodeCreationAndNodeMembersEditingMode.HorizontalScroll.Visible = false;
panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScroll = true;
panelLeftForNodeCreationAndNodeMembersEditingMode.Parent = this;
this.Controls.Add(panelLeftForNodeCreationAndNodeMembersEditingMode);
panelLeftForNodeCreationAndNodeMembersEditingMode.SendToBack();
panelLeftForNodeCreationAndNodeMembersEditingMode.ResumeLayout(false);
panelLeftForNodeCreationAndNodeMembersEditingMode.PerformLayout();
TextBox currentTextBox = null;
int xCoordinate = 30;
for (int i = 1; i <= 37; i++)
{
currentTextBox = new TextBox();
currentTextBox.Name = i.ToString();
currentTextBox.Size = new Size(85, 20);
currentTextBox.Tag = i.ToString();
currentTextBox.TabIndex = i - 1;
currentTextBox.TextAlign = HorizontalAlignment.Center;
currentTextBox.Text = currentTextBox.Name;
currentTextBox.Enabled = true;
currentTextBox.ReadOnly = true;
currentTextBox.CausesValidation = true;
currentTextBox.TabStop = true;
currentTextBox.BackColor = Color.DarkGray;
currentTextBox.Parent = panelLeftForNodeCreationAndNodeMembersEditingMode;
int yCoordinate = yCoordinate = 0 + (i - 1) * _verticalSpacing * 33 + _verticalSpacing * 5;
currentTextBox.Location = new Point(xCoordinate, yCoordinate);
textBox1.AppendText("TextBox " + currentTextBox.Name + " verticalCoordinate = " + yCoordinate.ToString() + Environment.NewLine);
int value = (currentTextBox.Location.Y + currentTextBox.Height) * 2 + _verticalSpacing * 40;
panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScrollPosition = new Point(0, value);
panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Maximum = 300;
int minimum = panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Minimum;
int maximum = panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Maximum;
//panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Value = value;
//panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Value = value;
panelLeftForNodeCreationAndNodeMembersEditingMode.SetAutoScrollMargin(0, 40);
panelLeftForNodeCreationAndNodeMembersEditingMode.ScrollControlIntoView(currentTextBox);
panelLeftForNodeCreationAndNodeMembersEditingMode.PerformLayout();
}
this.ResumeLayout();
}
private Panel panelLeftForNodeCreationAndNodeMembersEditingMode;
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
I use Visual Studio 2010.
Any idea would be greatly appreciated.
Thank you in advance.
My intention is to understand what I am doing wrong and how to correct my code and not to find a workaround (a different way to program it).
I'm trying to merge odd rows headecells in DataGridView, it seems work but when mouse moving over cells, they might be broken
The codes come here, how to improve this? Thanks!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DGVRowHeaderCellMerge
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.dataGridView1.Scroll += (s, e) => this.dataGridView1.Invalidate();
}
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.GetType().InvokeMember("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty, null, dataGridView1, new object[] { true });
dataGridView1.EnableHeadersVisualStyles = false;
dataGridView1.RowHeadersWidth = 160;
dataGridView1.ColumnHeadersHeight = 40;
dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.White;
dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
for (int i = 0; i < 50; i++)
{
DataGridViewColumn dc = new DataGridViewColumn();
dataGridView1.Columns.Add("ch" + i.ToString(), "C" + i.ToString());
dataGridView1.Columns[i].Width = 30;
dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
dataGridView1.Columns[i].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter;
this.dataGridView1.Columns[i].Resizable = DataGridViewTriState.False;
Application.DoEvents();
}
//dataGridView1.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
dataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect;
for (int j = 0; j < 100; j++)
{
int idx = dataGridView1.Rows.Add();
dataGridView1.Rows[idx].HeaderCell.Value = "R" + j.ToString();
dataGridView1.Rows[idx].HeaderCell.Style.WrapMode = DataGridViewTriState.True;
dataGridView1.Rows[idx].HeaderCell.Style.SelectionBackColor = Color.White;
dataGridView1.Rows[idx].HeaderCell.Style.BackColor = Color.White;
dataGridView1.Rows[idx].Resizable = DataGridViewTriState.False;
Application.DoEvents();
}
}
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
if (e.RowIndex == -1) return;
int rem = -1;
Math.DivRem(e.RowIndex + 1, 2, out rem);
if (rem == 0)
{
int i = e.RowIndex - 2;
Rectangle r1 = this.dataGridView1.GetCellDisplayRectangle(-1, i, true);
r1.X += 1;
r1.Y += 1;
r1.Width = r1.Width;
r1.Height = r1.Height * 2;
e.Graphics.FillRectangle(new SolidBrush(Color.LightYellow), r1);
StringFormat format = new StringFormat()
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
};
e.Graphics.DrawString(i.ToString(),
this.dataGridView1.ColumnHeadersDefaultCellStyle.Font,
new SolidBrush(this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor),
r1,
format);
Pen p = new Pen(Color.Red);
Point pTopLeft = new Point(r1.X - 1, r1.Y - 2);
Point pTopRight = new Point(r1.X + r1.Width - 2, r1.Y - 2);
e.Graphics.DrawLine(p, pTopLeft, pTopRight);
Point pBotRight = new Point(r1.X + r1.Width - 2, r1.Y + r1.Height);
e.Graphics.DrawLine(p, pTopRight, pBotRight);
}
}
}
}
this.dataGridView1.RowValidating += (s, e) => this.dataGridView1.Invalidate();
add this, it's ok now.
I just want to create multiple web control using c# in visual studio. I have written the code for that but it create only once, I think it show the control created at the last in the loop.
Here is the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MDMScreenSharing
{
public partial class Form2 : Form
{
private List<Skybound.Gecko.GeckoWebBrowser> geckowebbrouser;
public Form2()
{
InitializeComponent();
this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.AutoSize = true;
this.Padding = new Padding(0, 0, 20, 20);
this.StartPosition = FormStartPosition.CenterScreen;
}
private void Form2_Load(object sender, EventArgs e)
{
int inputNumber =5;
geckowebbrouser = new List<Skybound.Gecko.GeckoWebBrowser>();
for (int i = 1; i <= inputNumber; i++)
{
int j = 1;
String wbname = "br" + i;
Skybound.Gecko.GeckoWebBrowser gw = new Skybound.Gecko.GeckoWebBrowser();
gw.Width = 200;
gw.Height = 200;
gw.Parent = panel1;
gw.Name = wbname;
gw.Location = new Point(gw.Width, panel1.Bottom + (i * 30));
gw.Navigate("http://192.168.1.162:8080");
geckowebbrouser.Add(gw);
this.Controls.Add(gw);
j = j*gw.Width;
}
}
}
}
This will show the web control created at the last. I think the program should be more dynamic for that. What am I doing wrong?
The form output, that show only once.
with the new addition of code i have code that one of you provided. the code is
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MDMScreenSharing
{
public partial class Form2 : Form
{
private List<Skybound.Gecko.GeckoWebBrowser> geckowebbrouser;
public Form2()
{
InitializeComponent();
// this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
// this.AutoSize = true;
//this.Padding = new Padding(0, 0, 20, 20);
// this.StartPosition = FormStartPosition.CenterScreen;
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(602, 395);
this.flowLayoutPanel1.TabIndex = 0;
}
private void Form2_Load(object sender, EventArgs e)
{
int inputNumber =4;
geckowebbrouser = new List<Skybound.Gecko.GeckoWebBrowser>();
for (int i = 1; i <= inputNumber; i++)
{
String wbname = "br" + i;
Skybound.Gecko.GeckoWebBrowser gw = new Skybound.Gecko.GeckoWebBrowser();
gw.Parent = flowLayoutPanel1;
gw.Width = 200;
gw.Height = 200;
gw.Name = wbname;
gw.Navigate("http://192.168.1.162:8080");
geckowebbrouser.Add(gw);
flowLayoutPanel1.Controls.Add(gw);
}
}
}
}
but the problem in this case only one browser window navigate the page.
like this
as you can see.
I think better approach will be using FlowLoayoutPanel so that you don't have to handle the position of each new control.
Go like this:
Add the FlowLayoutPanel through visual designer from toolbox.
Then on your designer.cs you should automatically have:
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(602, 395);
this.flowLayoutPanel1.TabIndex = 0;
FormLoad event:
private void Form1_Load ( object sender, EventArgs e )
{
int inputNumber = 5;
geckowebbrouser = new List<Skybound.Gecko.GeckoWebBrowser>();
for ( int i = 1; i <= inputNumber; i++ )
{
int j = 1;
String wbname = "br" + i;
var gw = new Skybound.Gecko.GeckoWebBrowser();
gw.Width = 300;
gw.Height = 300;
gw.Name = wbname;
geckowebbrouser.Add(gw);
flowLayoutPanel1.Controls.Add(gw);
gw.Navigate("http://www.google.com");
}
}
Update
The only difference from the WebBrowser implementation is that you need to call the Navigate method after you've added the control to the panel. Check the updated code above.
I have tested with default Skybound.Gecko.GeckoWebBrowser control too, and it's working just fine too:
This uses bing's web service. I have a single image button and an array of image buttons. The single changes each time it is clicked to the next image in the array. The problem is if I click it and do a new search the array of image buttons does not change.
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using bing_search.net.bing.api;
using System.Collections;
namespace bing_search
{
public partial class _Default : System.Web.UI.Page
{
static ArrayList images = new ArrayList();
static Image[] imagearry;
static ImageButton[] imgButtnsArray;
static int counter = 0;
int fooBarCount = 0;
int firstLoad = 0;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DoItButton_Click(object sender, EventArgs e)
{
images.Clear();
imagearry = null;
imgButtnsArray = null;
BingService bs = new BingService();
net.bing.api.SearchRequest req = new SearchRequest();
req.AppId = "0B15AB60D625A10059A4A04B68615C5B0D904CA9";
req.Query = SearchBox.Text;
req.Sources = new SourceType[] { SourceType.Image};
req.Market = "en-us";
req.Adult = AdultOption.Off;
req.Image = new ImageRequest();
req.Image.CountSpecified = true;
req.Image.Count = 50;
SearchResponse resp = bs.Search(req);
foreach (ImageResult result in resp.Image.Results)
{
Image im = new Image();
im.ImageUrl = result.MediaUrl;
im.Width = 200;
im.Height = 200;
images.Add(im);
//this.Controls.Add(im);
}
// Image lol = (Image)images[0];
int size = images.Count;
imagearry = new Image[size];
Type typ = typeof(Image);
imagearry = (Image [])images.ToArray(typ);
ImageButton1.ImageUrl = imagearry[0].ImageUrl;
int blaCount = 0;
ArrayList imgButtns = new ArrayList();
foreach (Image ii in images)
{
ImageButton imgb = new ImageButton();
imgb.Width = 200;
imgb.Height = 200;
imgButtns.Add(imgb);
}
size = imgButtns.Count;
imgButtnsArray = (ImageButton[])imgButtns.ToArray(typeof(ImageButton));
foreach (ImageButton iii in imgButtnsArray)
{
imgButtnsArray[fooBarCount].ImageUrl = imagearry[fooBarCount].ImageUrl;
Panel1.Controls.Add(iii);
fooBarCount++;
}
fooBarCount = 0;
counter = 0;
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
counter++;
heightLable.Text = "clicked";
Image tempImage = (Image)imagearry[counter];
ImageButton1.ImageUrl = tempImage.ImageUrl;
foreach (ImageButton iii in imgButtnsArray)
{
imgButtnsArray[fooBarCount].ImageUrl = imagearry[fooBarCount].ImageUrl;
Panel1.Controls.Add(iii);
fooBarCount++;
}
fooBarCount = 0;
counter = 0;
}
}
}
You reset both counters on every click, so its always starts from the same image.
fooBarCount = 0;
counter = 0;
also they are not static, so they reset to 0 anyway on every page load, and show the same image and not change.
If from the other hand the cache is the problem, because I can not know whats the image file name, and maybe this is the issue here, then try something like.
imgButtnsArray[fooBarCount].ImageUrl =
imagearry[fooBarCount].ImageUrl +
"?rnd=" + RandomNumber.ToString();
I changed ImageButton1_Click to this and now it works. thanks for the quick responses. Back to playing with .net
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
counter++;
heightLable.Text = "clicked";
Image tempImage = (Image)imagearry[counter];
ImageButton1.ImageUrl = tempImage.ImageUrl;
//Random RandomNumber = new Random(10000);
foreach (ImageButton iii in imgButtnsArray)
{
Panel1.Controls.Add((Image)imagearry[fooBarCount]);
fooBarCount++;
}
fooBarCount = 0;
counter = 0;
}
It's my problem.
I have a few RadioButtons. If i click on first Radiobutton on form create TextBox, if click on second - create second TextBox and if i click again on first RadioButton, again one TextBox,is it possible?
Give me idea, please.
And without property visible.
There isn't much point in dynamically creating and destroying controls here. It is just a headache, ensuring the position, size and tab order is correct. Just make the text box visible if you like the choice:
private void radioButton2_CheckedChanged(object sender, EventArgs e) {
textBox1.Visible = radioButton2.Checked;
}
Set the textbox' Visible property to False in the designer.
Try something like this (this is only one of them):
TextBox t;
private void radio_CheckedChanged(object sender, System.EventArgs e)
{
if (radio.Checked) {
t = new TextBox();
t.Top = radio.Top;
t.Left = radio.Left + radio.Width;
this.Controls.Add(t);
t.Show();
} else {
if (t!=null)t.Dispose();
}
}
See Only foreach and void TextBoxes.
using System;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
class MyForm : Form
{
private const int
HeightTextBox = 40, WidthTextBox = 25, //размер textboxes
DistanceBetweenTexBoxHeight = 25, DistanceBetweenTexboxWigth = 25; //растояние между ними
private int DimentionalTextBox = 3;
private const int
RadioButtonNumbers = 3, // количество радио кнопок
DistanceBetweenRadiobutton = 50,
RadioButtonFirstGroupStartPositionX = 5,
RadioButtonSecondGroupStartPositionX = 0,
RadioButtonFirstGroupStartPositionY = 0,
RadioButtonSecondGroupStartPositionY = 0,
RadioButtonSize = 25;
public MyForm()
{
//Size of window
ClientSize = new System.Drawing.Size(7 * HeightTextBox + 8 * DistanceBetweenTexBoxHeight,
7 * WidthTextBox + 8 * DistanceBetweenTexboxWigth);
//Create RaioButton
int x = RadioButtonFirstGroupStartPositionX;
int y;
RadioButton[] DimRadioButtons = new RadioButton[RadioButtonNumbers];
for (int i = 0; i < RadioButtonNumbers; i++)
{
DimRadioButtons[i] = new RadioButton();
DimRadioButtons[i].Name = "RadioButton" + (i + 2);
DimRadioButtons[i].Text = Convert.ToString(i + 2);
DimRadioButtons[i].SetBounds(x, RadioButtonFirstGroupStartPositionY, RadioButtonSize, RadioButtonSize);
x += DistanceBetweenRadiobutton;
Controls.Add(DimRadioButtons[i]);
}
//Watch dimention
// And catch even click on RadioButton
foreach (var a in this.Controls)
{
if (a is RadioButton)
{
if (((RadioButton)a).Checked)
{
DimentionalTextBox = Convert.ToInt16(((RadioButton)a).Text);
((RadioButton)a).Click += new EventHandler(this.TextBoxes);
}
}
}
}
// Create-Delete TextBoxes
private void TextBoxes(object sender, EventArgs e)
{
RadioButton rb_click = (RadioButton)sender;
int x = RadioButtonFirstGroupStartPositionX;
int y = 30;
int dim = Convert.ToInt16(rb_click.Text);
TextBox[,] MatrixTextBoxes = new TextBox[dim, dim];
for (int i = 0; i < dim; i++)
{
for (int j = 0; j < dim; j++)
{
MatrixTextBoxes[i, j] = new TextBox();
MatrixTextBoxes[i, j].Top = rb_click.Top;
MatrixTextBoxes[i, j].Name = "MatrixTextBox" + i + j;
MatrixTextBoxes[i, j].Text = i + " " + j;
MatrixTextBoxes[i, j].SetBounds(x, y, WidthTextBox, HeightTextBox);
x += DistanceBetweenTexboxWigth;
this.Controls.Add(MatrixTextBoxes[i, j]);
MatrixTextBoxes[i, j].Show();
}
y += DistanceBetweenTexBoxHeight;
x = RadioButtonFirstGroupStartPositionX;
}
}
}
class MyClassMain : MyForm
{
public static void Main()
{
Application.Run(new MyClassMain());
}
}