Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6318049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:35:51+00:00 2026-05-24T15:35:51+00:00

code to add dynamic data getdata() { SqlConnection con = new SqlConnection(Data source=XXXXX;Initial catalog=dummy;integrated

  • 0

code to add dynamic data

getdata()  
{  
SqlConnection con = new SqlConnection("Data source=XXXXX;Initial catalog=dummy;integrated security=true");  
            DataTable dt = new DataTable();  
            DataColumn col = new DataColumn("Title", typeof(System.String));  
            dt.Columns.Add(col);  
            DataRow row = dt.NewRow();  
            con.Open();  
            SqlCommand cmd = new SqlCommand("select  Title,Description from systemtray", con);  
            SqlDataReader dr;  
            dr = cmd.ExecuteReader();  
            while (dr.Read())  
            {  
              string s=dr["Title"].ToString()+Environment.NewLine+dr["Description"].ToString();    

                row["Title"]= s.Trim();  

                dt.Rows.Add(row["Title"]);  
            }  
            dataGridView1.DataSource = dt; 
}

and i add two buttons to datagrid using properties.Here the out put is:two buttons are displaying at index [0],[1] and the data is displaying at last column,i need to display the data at index[0] position then two buttons.how can i set index manually.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T15:35:51+00:00Added an answer on May 24, 2026 at 3:35 pm

    From a Form Designer add new DataGridViewTextBoxColumn and move it to top most position or at whatever position you would like to display this column at, then in properties of this DataGridViewTextBoxColumn set DataPropertyName to the name of your column, which from your code, i can see that is Title, that’s it, compile, run and it should display the text column before button columns… I have attached a screenshot for you, I hope it will solve your problem…

    posit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code to add a pfx to the Cert store. X509Store store
I have a piece of C# code that add the values of an enum
This code works fine: $result = $client->__call(optionalInfo, array( new SoapParam(..., client), new SoapParam(..., add_code))
I'm trying to find a way to automate some exception logging code to add
I'm thinking to add some code on the server side in asp.net, to verify
I'm looking for a sequence of steps to add java code formatting to my
When IE8 is released, will the following code work to add a conditional stylesheet?
What code do you need to add in PHP to automatically have the browser
In the code below I use mpf_add to add the string representation of two
(code examples are python) Lets assume we have a list of percentages that add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.