473,837 Members | 1,460 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 1471
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
2449
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
7038
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
4497
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
1884
by: Richard | last post by:
Hello MyMainWebPage.aspx contains MyUserControl.ascx MyUserControl.ascx has a DataTable Property MyDataTable
7
1588
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
4418
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
1037
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
2799
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
1304
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
9843
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
9683
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,...
1
10630
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10275
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
7811
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
7005
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5670
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
5851
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4476
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

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.