Click here to Skip to main content
15,891,253 members
Home / Discussions / C#
   

C#

 
AnswerRe: References to an object Pin
Guffa11-Mar-07 16:26
Guffa11-Mar-07 16:26 
GeneralRe: References to an object Pin
Zoltan Balazs11-Mar-07 17:41
Zoltan Balazs11-Mar-07 17:41 
GeneralRe: References to an object Pin
Zoltan Balazs12-Mar-07 7:15
Zoltan Balazs12-Mar-07 7:15 
QuestionHow to assign value to generic list member Pin
AndrusM11-Mar-07 10:46
AndrusM11-Mar-07 10:46 
AnswerRe: How to assign value to generic list member Pin
S. Senthil Kumar11-Mar-07 14:07
S. Senthil Kumar11-Mar-07 14:07 
QuestionAppDomain + Reflection Pin
AJ12311-Mar-07 9:58
AJ12311-Mar-07 9:58 
AnswerRe: AppDomain + Reflection Pin
S. Senthil Kumar11-Mar-07 14:11
S. Senthil Kumar11-Mar-07 14:11 
QuestionDataGridView IDENTITY column binding problem Pin
Deian11-Mar-07 9:13
Deian11-Mar-07 9:13 
Hello,

Did I miss something to setup in the following code snippet in order the binding to work correctly with the IDENTITY Column ID? When I try to edit the title field, the grid does not display the next IDENTITY value in the read-only column ID.

Any help appreciated Smile | :)

public partial class frmExpensesList : Form
 {
     // the sql connection
     SqlConnection sqlConn;
     // the sql adapter
     SqlDataAdapter sqlAdapter;
     // binding source
     BindingSource bind;
     // insert/update/delete command builder
     SqlCommandBuilder sqlCmd;
     // the actual table
     DataTable tbl;

     public frmExpensesList()
     {
         InitializeComponent();
     }

     private void frmExpensesList_Load(object sender, EventArgs e)
     {
         sqlConn = new SqlConnection();
         sqlConn.ConnectionString = "Integrated Security=true;" +
                                    "Initial Catalog=Expenses;" +
                                    "Data Source=(local);";

         string selCmd = "SELECT ID, Title FROM tblExpenseGroup";

         try
         {
             sqlConn.Open();
             // build sql adapter based on select command / connection string
             sqlAdapter = new SqlDataAdapter(selCmd, sqlConn);
             // generate update/insert/delete statements
             sqlCmd = new SqlCommandBuilder(sqlAdapter);
             // create table
             tbl = new DataTable();
             // localize table
             tbl.Locale = System.Globalization.CultureInfo.InvariantCulture;
             // fill table with data
             sqlAdapter.Fill(tbl);
             // create binding source
             bind = new BindingSource();
             // connect binding source with the table
             bind.DataSource = tbl;
             groupsGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
             // connect grid with the binding source
             groupsGrid.DataSource = bind;
             // set ID to read only
             groupsGrid.Columns[0].ReadOnly = true;
         }
         catch (SqlException s)
         {
             MessageBox.Show(s.Message);
         }
         finally
         {
             sqlConn.Close();
         }
     }

     private void btnCancel_Click(object sender, EventArgs e)
     {
         Close();
     }
 }

AnswerRe: DataGridView IDENTITY column binding problem Pin
Deian11-Mar-07 11:31
Deian11-Mar-07 11:31 
Questionsimple 2d graphics with c# Pin
liquidfluid11-Mar-07 8:35
liquidfluid11-Mar-07 8:35 
AnswerRe: simple 2d graphics with c# Pin
Ed.Poore11-Mar-07 8:50
Ed.Poore11-Mar-07 8:50 
Questionmarshaling of the const char * Pin
MinaFawzi11-Mar-07 6:21
MinaFawzi11-Mar-07 6:21 
AnswerRe: marshaling of the const char * Pin
Ed.Poore11-Mar-07 7:52
Ed.Poore11-Mar-07 7:52 
QuestionPassing member variables as private method arguments? Pin
David Veeneman11-Mar-07 5:38
David Veeneman11-Mar-07 5:38 
AnswerRe: Passing member variables as private method arguments? Pin
S. Senthil Kumar11-Mar-07 5:55
S. Senthil Kumar11-Mar-07 5:55 
GeneralRe: Passing member variables as private method arguments? Pin
David Veeneman11-Mar-07 7:32
David Veeneman11-Mar-07 7:32 
AnswerRe: Passing member variables as private method arguments? Pin
Christian Graus11-Mar-07 4:55
protectorChristian Graus11-Mar-07 4:55 
AnswerRe: Passing member variables as private method arguments? Pin
Leslie Sanford11-Mar-07 16:52
Leslie Sanford11-Mar-07 16:52 
GeneralRe: Passing member variables as private method arguments? Pin
David Veeneman11-Mar-07 7:36
David Veeneman11-Mar-07 7:36 
GeneralRe: Passing member variables as private method arguments? Pin
David Veeneman12-Mar-07 4:14
David Veeneman12-Mar-07 4:14 
QuestionGenerate Panel Pin
shamsteady11-Mar-07 5:35
shamsteady11-Mar-07 5:35 
AnswerRe: Generate Panel Pin
Dave Kreskowiak11-Mar-07 6:48
mveDave Kreskowiak11-Mar-07 6:48 
QuestionAutomatically paste into active window from my code Pin
Cedric_NewUser11-Mar-07 5:19
Cedric_NewUser11-Mar-07 5:19 
QuestionHow to create a control panel for my DVD Playback Windows Application Pin
Khoramdin11-Mar-07 4:04
Khoramdin11-Mar-07 4:04 
AnswerRe: How to create a control panel for my DVD Playback Windows Application Pin
Christian Graus11-Mar-07 4:51
protectorChristian Graus11-Mar-07 4:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.