Quantcast
Viewing all articles
Browse latest Browse all 12583

DataGridView Issue.

My Program Works the following Way:

  1. Enter text to encode in text box (txtBox1)
  2. Click Button to make bar code
  3. Barcode displays in picture box (picBarcode)

The code to actually generate the barcode from this text box is :

Image myimg = Code128Rendering.MakeBarcodeImage(txtTrackNum.Text, int.Parse(txtWeight.Text), true); 

pictBarcode.Image = myimg;

However I want to implement this code using it to perform the following:

  1. Get Cell value from a column in a datagridview named "colTrack"
  2. Make barcode using the cell value
  3. Place barocde in a cell next to it , under a picture column called "colBarcode"
  4. Do this for each row in the datagridview and then display a message box.

Can someone please write me a sample solution as my project has come to a complete halt, until i find a fix.

Visual Representation (Apologizes for the poor quality) :

Image may be NSFW.
Clik here to view.


I was provided with the following free written samples but im still unsure how to write this:

// Assuming you have a DataGridView with at least these columns
DataGridView _DataGridView as new DataGridView();
DataGridViewTextBoxColumn _DataGridViewTextBoxColumn as new DataGridViewTextBoxColumn();
DataGridViewImageColumn _DataGridViewImageColumn as new DataGridViewImageColumn();

_DataGridView.Columns.Add(_DataGridViewTextBoxColumn);
_DataGridView.Columns.Add(_DataGridViewImageColumn);


// Add a row to the DataGridView
Image Barcode = Code128Rendering.MakeBarcodeImage(txtTrackNum.Text, int.Parse(txtWeight.Text), true);

_DataGridView.Rows.Add(txtTrackNum.Text,Barcode);

private void GenerateAllBarCode_Click(object sender, EventArgs e)
    {
        foreach (DataGridViewRow row in dataGridView1.Rows)
        {
Image myImg = Code123Rendering.MakeBarcodeImage(          row.Cells["update"].Value,...);
        }
    }
Thanks to anyone that helps. I really need it.


Viewing all articles
Browse latest Browse all 12583

Trending Articles