473,767 Members | 2,226 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

windows form datagrid questions

I have a datagrid on my windows form, it needs to be read only and when a
user selects a row, I want the whole row to be selected.

How would I go about doing this?

--
Thanks
Wayne Sepega
Jacksonville, Fl

Enterprise Library Configuration Console Module Generator
http://workspaces.gotdotnet.com/elccmg

"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
Nov 17 '05 #1
2 1469
http://www.syncfusion.com/FAQ/WinFor...44c.aspx#q689q

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Wayne" <Me******@commu nity.nospam> wrote in message
news:Og******** ******@TK2MSFTN GP15.phx.gbl...
I have a datagrid on my windows form, it needs to be read only and when a
user selects a row, I want the whole row to be selected.

How would I go about doing this?

--
Thanks
Wayne Sepega
Jacksonville, Fl

Enterprise Library Configuration Console Module Generator
http://workspaces.gotdotnet.com/elccmg

"When a man sits with a pretty girl for an hour, it seems like a minute.
But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein


Nov 17 '05 #2
Hi Wayne

Interestingly, I've had to do exactly this today. If you start with the
Windows Forms FAQ (at Syncfusion), then that will get you started. I needed
row selection together with ReadOnly data, and also not having the text in
the cell highlighted when I clicked on it, and had to hack it together with a
MouseDown and MouseUp pair of handlers to set the Enable property on the
DataGrid to false, then to true while doing the selection - it felt like a
terrible hack (and I didn't test it much...), and would be interested to see
if other people have a more elegant way of achieving the same thing.

Nigel

private void DataGrid1_Mouse Down(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
System.Drawing. Point pt = new Point(e.X, e.Y);
DataGrid.HitTes tInfo hti = this.DataGrid1. HitTest(pt);

if(hti.Type == DataGrid.HitTes tType.Cell)
{

this.DataGrid1. CurrentCell = new DataGridCell(ht i.Row, hti.Column);
this.DataGrid1. Enabled = false;
this.DataGrid1. Select(hti.Row) ;
this.DataGrid1. Enabled = true;
}

}

private void DataGrid1_Mouse Up(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
System.Drawing. Point pt = new Point(e.X, e.Y);
DataGrid.HitTes tInfo hti = this.DataGrid1. HitTest(pt);

if(hti.Type == DataGrid.HitTes tType.Cell)
{

this.DataGrid1. CurrentCell = new DataGridCell(ht i.Row, hti.Column);
this.DataGrid1. Select(hti.Row) ;
}
}

Here's the code:

"Wayne" wrote:
I have a datagrid on my windows form, it needs to be read only and when a
user selects a row, I want the whole row to be selected.

How would I go about doing this?

--
Thanks
Wayne Sepega
Jacksonville, Fl

Enterprise Library Configuration Console Module Generator
http://workspaces.gotdotnet.com/elccmg

"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2438
by: PAUL EDWARDS | last post by:
I have a windows form that is bound to a datatable. In VB6 I could just update the field contents and it would be updated in the database, however if I update the text property of the control from code it is 50% chance that the update will make it back to the dataset. If I update the dataset instead of the form, it does not show on the form. Is there a method that should be used?
4
7036
by: John | last post by:
Hello all, I'm trying to display a dataset into a datagrid and format the datagrid columns but I'm having a hard time with it. I've tried the MSDN examples but they don't seem to work. Basically, what I want to do is that, on a button click, the dataset fills up dynamically, binds to the datagrid, and displays the data. This is my code: mySql = "select itemID, OrderDate " +
4
4495
by: Carl Fenley | last post by:
I believe I have almost successfully created a custom datagrid control. The new class builds without error. I have added it as reference to the main Windows Application project. It appears on the Toolbox as expected, but... When I drag-drop it on a Form, it appears like a component (e.g. SqlConnection) down in it's own area not drawn on the form. When I created the Windows Control Library, I never actually added a DataGrid control...
1
1880
by: Richard | last post by:
Hello MyMainWebPage.aspx contains MyUserControl.ascx MyUserControl.ascx has a DataTable Property MyDataTable
7
1583
by: Richard | last post by:
If the grid is dragged off the screen and back on the data is visible. Tried a dg.refresh() and Inactivate(). Can I do this by overriding custom base class OnPaint that my form inherits from? I don't thin it is the backcolor or something like that because the error does not occur on everyone's workstation. Could be it be the video card or tied to memory. Also when I get the error at the office computer if I remote connect to that...
8
4415
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip code is passed to the lookup form/dialog by reference. I then load a...
0
1036
by: Simon Prince | last post by:
Hi I have created a .NET "Windows Custom Control" which is used an ASPX Web Form. It is referenced with the code, from a ASPX page. ************************************************** <object id="myComponent" classid="http:#"
1
2797
by: Rajesh Kumar Choudhary | last post by:
Hi, I want to use the system.windows.form.datagrid control present in .net 2005 or 2003. Is it possible to use this? Please let me know if it is not supported. I have seen and used the classes from FCL using system.tlb or mscorelib.tlb from dot net framework. I could use ArrayList successfully without any issue.
3
1302
Daxthecon
by: Daxthecon | last post by:
I'm using VS 2008 and Microsoft SQL Server Express Edition to program an ASP.NET/VB web application. The web application has to do with putting in products to populate a table veiwed by another page where the person veiwing that page will have the permissions to deny/allow the purchase of the product to the user. Now down to what needs to be done... 1. I need to know how to use Windows Authentication to be passed from on Web app into this...
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9838
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5279
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.