0

I know it can be creates like:

TextBox[] tbsArray = new TextBox[2];
tbsArray[0] = textBox1;
tbsArray[1] = textBox2;

//or:
TextBox[] tbsArray = new TextBox[] { textBox1, textBox2 };

//or in a loop:
foreach(TextBox tb in new TextBox[] { textBox1, textBox2 })
{
     //...
}

If there is any other way you would like to have it, let us know.
bye

0

As Jorge mentions, it seems like you accidentally zoomed out in Chrome. From the Tools menu, click Zoom to 100%. You can also hold down the Ctrl key and scroll the mouse up.

This was partly true, but not the zoom that was doing problems, in new chrome there is an icon beside zoom, just clicked on it, and now its all fine :)
thx god!
And thx for your decent explanation. I hope daniweb returns to its best days :)
best regards

0

Hi, since this forum has been modified majorly (this happened approx. 6 months ago) nothing works at it should. There is a lot less people asking question (and answering on them), it seems like you have driven them away with these (not-good changes -personally it was whole much better before that huge webiste update), nor the forum it self does not work like it should.
And a few days ago (including today) the forum size has been shrinked, redused to some small size (like 600x400 pixels). This is refering to Chrome web browser, in Opera seem to be all ok.
What is going on here?

I just want to remind you, if this is keep on happening, people will go from here (leaving), to other forums. Just to keep you awake, I dont think nothing bad with this few statements of mine! I hope I will wake you up moderators and people who are responsable for this (used to be) great forum!

Mitja

0

Do the loop through the rows of dgv and check if row is selected:

   using(SqlConnection conn = new SqlConnection("connString"))
   {     
       foreach (DataGridViewRow dr in dataGridView2.Rows)
       {    
           DataGridViewCheckBoxCell check = row.Cells[0] as DataGridViewCheckBoxCell;
           if(check != null && (bool)check.Value) //1st parameter must not be null, 2nd parameter must me true!
           {
               string query = @"UPDATE TableName SET FieldName2 = @param1 WHERE FieldName1 = @param2"; //query
               using(SqlCommand cmd = new SqlCommand(query, conn))
               {
                   cmd.Parameters.Add("@param1", SqlDbType.VarChar, 50).Value = row.Cells["ColumnName2"].Value.ToString(); //set appropriate column name or its index
                   cmd.Parameters.Add("@param2", SqlDbType.Int).Value = int.Parse(row.Cells["ColumnName1"].Value.ToString()); //same here!! - this is some id (unique) column
                   try
                   {
                       if(conn.State != ConnectionState.Open)
                           conn.Open();
                       cmd.ExecuteNonQuery();
                   }
                   catch(Exception ex)
                   {
                       MessageBox.Show(ex.Message);
                       break; //go out of the loop when 1st error occurs! - you can remove it
                   }
               }
           }
       }
   }
1

How do you intend to pass the data from DGV to textBox? On a row (cell) click?
Some other way?
If so, do it like:

textBox1.Text = dgv[ColumnIndex, RowIndex].Value.ToString();

if you want to add data to textBox (multiline) use += insted of = only and add "\r\n" before code:

textBox1.Text += dgv[ColumnIndex, RowIndex].Value.ToString() + "\r\n"; //for adding new line for next insert
Votes + Comments
nice
0

DO:

//on main form:
void OpenClient()
{
    Client c = new Client(this);
    c.DoWork();
}

public void AddText(string text)
{
    this.richTextBox1.AppendText(text+Environment.NewLine);
}

//on client class:
class Client
{
    MainForm mf;
    public Client(MainForm _mf)
    {
        this.mf = _mf;
    }

    public DoWork()
    {
        string text = "";
        //do some work ... and add value to text field;
        //and pass to rtb on main form:
        mf.AddText(text);
    }
}