C# BAŞKA FORMDAN BİLGİ ALMAK

        private void SICILLIST()
        {
            using (SICILLERBORDRO siciller = new SICILLERBORDRO(lbl_FIRMNR.Text))
            {
                if (siciller.ShowDialog() == DialogResult.OK)
                {
                    be_SICILNO.EditValue = siciller.VALUES[0].ToString();
                    be_ADSOYAD.EditValue = siciller.VALUES[1].ToString();
                }
            }
        }


        private void be_SICILNO_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            SICILLIST();
        }
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Data.SqlClient;

namespace BMS_INSAAT_MODULU.FORM
{
    public partial class SICILLERBORDRO : DevExpress.XtraEditors.XtraForm
    {
        public object[] VALUES { get; set; }

        public SICILLERBORDRO(string FIRMANR)
        {
            InitializeComponent();
            BMS_DLL.CFGGETSET.AYARLARIYUKLE(); 
            gridControl1.DataSource = BMS_DLL.SQL.SELECT2("select LOGICALREF ID, CODE SICILNO,NAME+' '+SURNAME ADSOYAD from BM_PERSON WHERE FIRMNR=" + FIRMANR, new SqlConnection(string.Format(@"Server={0}; Database={1}; User Id ={2};Password ={3}", BMS_DLL.CFGICERIK.BMSDBSERVER, BMS_DLL.CFGICERIK.BMSDBDATABASE, BMS_DLL.CFGICERIK.BMSDBUSERNAME, BMS_DLL.CFGICERIK.BMSDBPASSWORD)));
        }
        private object[] GET_SELECTED_ITEMS(int ROWHANLE)
        {
            try
            {
                return new object[] { ((string)this.gridView1.GetRowCellValue(ROWHANLE, "SICILNO")), ((string)this.gridView1.GetRowCellValue(ROWHANLE, "ADSOYAD")) };
            }
            catch
            {
                return null;
            }
        }

        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            this.VALUES = this.GET_SELECTED_ITEMS(this.gridView1.FocusedRowHandle);
            if (this.VALUES != null)
            {
                base.DialogResult = DialogResult.OK;
                base.Close();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BMS_DLL.DX.DXGRIDEXCELEKAYDET(gridView1, true);
        }
    }
}

Leave a comment