473,473 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows Forms Data GridView

1 New Member
Hai,
I am sambath Raj.I am new for you.Now i am trying to use windows forms with data GridView Controll.Now i am adding combobox in that data GridView but defaultly New Row Will be added next to the combobox row.How can i prevent or stop to add new rows.Here i gave my code below.Correect that and send me the mail.


Mail id : sambathrajmca@yahoo.co.in

My Code

DataGridViewComboBoxColumn cbocustomerorder = new DataGridViewComboBoxColumn();
cbocustomerorder.HeaderText = "Order";
cbocustomerorder.Name = "Order Name";
cbocustomerorder.Items.Add("Welcome");
this.dataGridView1.Columns.Add(cbocustomerorder);


With Regards
Sambath Raj.C
May 10 '07 #1
1 10226
Paulson
63 New Member
Hai,
I am sambath Raj.I am new for you.Now i am trying to use windows forms with data GridView Controll.Now i am adding combobox in that data GridView but defaultly New Row Will be added next to the combobox row.How can i prevent or stop to add new rows.Here i gave my code below.Correect that and send me the mail.


Mail id : sambathrajmca@yahoo.co.in

My Code

DataGridViewComboBoxColumn cbocustomerorder = new DataGridViewComboBoxColumn();
cbocustomerorder.HeaderText = "Order";
cbocustomerorder.Name = "Order Name";
cbocustomerorder.Items.Add("Welcome");
this.dataGridView1.Columns.Add(cbocustomerorder);


With Regards
Sambath Raj.C

Hi SambathRaj,


Hi I work in vb and am not so good at c# but I can tell you-->


This happens because the property of ur gird AllowUsertoAddRows is set to true.

Solution:

In gridview properties set AllowUserToAddrows as false.

Then specify the number of columns needed and write the code.

I shall give you vb sample you will have to convert it into c#.

Sample code
__________________________________________________ _______________



Dim cbocustomerorder As DataGridViewComboBoxColumn = New DataGridViewComboBoxColumn()
cbocustomerorder.HeaderText = "Order"
cbocustomerorder.Name = "Order Name"
cbocustomerorder.Items.Add("Welcome")
DataGridView1.Columns.Add(cbocustomerorder)
DataGridView1.Rows.Add(5)


__________________________________________________ _______________

Anyway if your problem is solved pls inform me.
Keep the good work going.


bye Paulson.
May 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
2
by: Budhi Saputra Prasetya | last post by:
Hi, I managed to create a Windows Form Control and put it on my ASP .NET page. I have done the suggestion that is provided by modifying the security settings. From the stack trace, I would...
0
by: Budhi Saputra Prasetya | last post by:
Hi, I still have the same problem with embedding Windows Control. I'll just requote what I posted last time: I managed to create a Windows Form Control and put it on my ASP .NET page. I...
12
by: Seth Bourne | last post by:
It is really painfull when migrating from Windows Application to Web Application. it's because web application has so many weakness which have the user to use 'more mouse' than 'keyboard' it self....
1
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I...
4
by: Kisankoori | last post by:
Hi All, I am developing a Windows Forms 2.0 application. I have some questions on the DataGridView. I have two Datagridviews on the form which I have populated from the the database tables...
3
by: shobhitguptait | last post by:
How to Run C#.NET Windows App on N/W with centralized DB using SQL SERVER 2000 Hello All...i m really grate full to c such a website where developers try to help people like us who face problems...
0
by: pavanip | last post by:
Hi, I am facing problem with combobox in gridview.I have used combobox in gridview and i am binding data to gridview combobox from database. If i click 2 times on combobox then it is showing the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.