Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,060 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,586 people online right now. Registration is fast and FREE... Join Now!




Datagrid Parameter

 
Reply to this topicStart new topic

Datagrid Parameter

Gego levente
4 Apr, 2008 - 07:03 AM
Post #1

New D.I.C Head
*

Joined: 4 Apr, 2008
Posts: 4

[font=Georgia]
Im using Visual Studio 2008 language C#.
I have a form with a dataGrid populated from an SQL Stored Procedure, one of the columns on the datagrid it's ButtonColumn and exactly this Buttons HeaderText I would like to use as a parameter for another Stored Procedure.
So if the button is clicked will open a New form with a Datagrid but this time the Datagrid will be populated with a new Stored Procedure which has a parameter and for Parameter value I want to use from the 1st form the ButtonColum Header text.
Is this Possibile?

Thank you

User is offlineProfile CardPM
+Quote Post

killnine
RE: Datagrid Parameter
4 Apr, 2008 - 07:48 AM
Post #2

D.I.C Head
**

Joined: 12 Feb, 2007
Posts: 107



Thanked: 3 times
My Contributions
QUOTE(Gego levente @ 4 Apr, 2008 - 08:03 AM) *

[font=Georgia]
Im using Visual Studio 2008 language C#.
I have a form with a dataGrid populated from an SQL Stored Procedure, one of the columns on the datagrid it's ButtonColumn and exactly this Buttons HeaderText I would like to use as a parameter for another Stored Procedure.
So if the button is clicked will open a New form with a Datagrid but this time the Datagrid will be populated with a new Stored Procedure which has a parameter and for Parameter value I want to use from the 1st form the ButtonColum Header text.
Is this Possibile?

Thank you



Possible? If I understand your question correctly, yes.

Hopefully I understood you correctly, but what you probably want to do add an event to the button on the first form. The method will create a new new form. What you can do is, in the non-default constructor for the new form, add an argument for the parameter you want to pass from the first form.

Hopefully this makes sense, and hopefully it is a half-decent solution =P.

Please post some code so that others will be able to pitch in.
User is offlineProfile CardPM
+Quote Post

Gego levente
RE: Datagrid Parameter
4 Apr, 2008 - 09:59 AM
Post #3

New D.I.C Head
*

Joined: 4 Apr, 2008
Posts: 4

the first form
CODE

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 Data_Shop_Details
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
            this.sp_xMagazinSelectTableAdapter.Fill(this.mysqlDataSet1.sp_xMagazinSelect);

        }

        private void CodGest_TextChanged(object sender, EventArgs e)
        {
            spxMagazinSelectBindingSource.Filter =
            "CodGest like '%" + CodGest.Text + "%'";
        }

        private void NumeGest_TextChanged(object sender, EventArgs e)
        {
            spxMagazinSelectBindingSource.Filter =
            "Numegest like '%" + NumeGest.Text + "%'";
        }

        private void Zona_TextChanged(object sender, EventArgs e)
        {
            spxMagazinSelectBindingSource.Filter =
            "Zona like '%" + Zona.Text + "%'";
        }

        private void CodJudet_TextChanged(object sender, EventArgs e)
        {
            spxMagazinSelectBindingSource.Filter =
            "Codjudet like '%" + CodJudet.Text + "%'";
        }

        private void TipGest_TextChanged(object sender, EventArgs e)
        {
            spxMagazinSelectBindingSource.Filter =
            "TipGest like '%" + TipGest.Text + "%'";
        }

        private void IpClass_TextChanged(object sender, EventArgs e)
        {
            spxMagazinSelectBindingSource.Filter =
          "IpClass like '%" + IpClass.Text + "%'";
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
  
            Form2 frm;
            frm = new Form2();
            frm.Show();

        }


      
    }

}

----------------------------------------------------------------------------
The 1st Form Designer Code:
CODE

namespace Data_Shop_Details
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        private mysqlDataSet mysqlDataSet1;
        private System.Windows.Forms.DataGridView dataGridView1;
        private System.Windows.Forms.BindingSource spxMagazinSelectBindingSource;
        private Data_Shop_Details.mysqlDataSetTableAdapters.sp_xMagazinSelectTableAdapter sp_xMagazinSelectTableAdapter;
        private System.Windows.Forms.TextBox NumeGest;
        private System.Windows.Forms.TextBox Zona;
        private System.Windows.Forms.TextBox CodJudet;
        private System.Windows.Forms.TextBox TipGest;
        private System.Windows.Forms.TextBox IpClass;
        private System.Windows.Forms.TextBox CodGest;
        private System.Windows.Forms.Label Filter;
        private System.Windows.Forms.DataGridViewButtonColumn codGestDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn numeGestDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn zonaDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn codJudetDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn tipGestDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn ipClassDataGridViewTextBoxColumn;

    }
}

---------------------------------------------------------------------------------------------------------------------------------------



QUOTE

Possible? If I understand your question correctly, yes.

Hopefully I understood you correctly, but what you probably want to do add an event to the button on the first form. The method will create a new new form. What you can do is, in the non-default constructor for the new form, add an argument for the parameter you want to pass from the first form.

Hopefully this makes sense, and hopefully it is a half-decent solution =P.

Please post some code so that others will be able to pitch in.

User is offlineProfile CardPM
+Quote Post

Gego levente
RE: Datagrid Parameter
4 Apr, 2008 - 10:33 PM
Post #4

New D.I.C Head
*

Joined: 4 Apr, 2008
Posts: 4

hummm??
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 06:28PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month