473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Fill datatable

hi,

How can I fill some DataTable by clicking in cells of a DataGrid control?

NOTE: I don't want to select a entire row, ok? I must select only one or
more cells...

I have a DataGrid that have some data that I must select what I want and
then by clicking in a Button it will create some records in DataBase.
So I want to construct a DataTable by clicking in DataGrid, for then allows
me to cover this DataTable and create the records in DB.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
Nov 19 '05 #1
3 1281
ruca wrote:
hi,

How can I fill some DataTable by clicking in cells of a DataGrid control?

NOTE: I don't want to select a entire row, ok? I must select only one or
more cells...

I have a DataGrid that have some data that I must select what I want and
then by clicking in a Button it will create some records in DataBase.
So I want to construct a DataTable by clicking in DataGrid, for then allows
me to cover this DataTable and create the records in DB.

The example below is used to make it so no column can be selected but
selects the entire row instead. Add it to your datagridtablestyle.
Then you will need to capture the click event in the datagrid (probably
should just be capture the row change instead) and do a datagridhittest
on it.

Hope that helps
Chris

FullDisclosure: This was used from some website... No idea who
Public Class DataGridNoActiveCellColumn
Inherits DataGridTextBoxColumn

Private SelectedRow As Integer = -1
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal
bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal
instantText As String, ByVal cellIsVisible As Boolean)

'make sure previous selection is valid
If SelectedRow > -1 And SelectedRow < source.List.Count + 1 Then
Me.DataGridTableStyle.DataGrid.UnSelect(SelectedRo w)
End If
SelectedRow = rowNum
Me.DataGridTableStyle.DataGrid.Select(SelectedRow)
End Sub

End Class

Nov 19 '05 #2
hi,

I think that you're talking about Windows Forms, and I'm talk about Web
Forms. It's a quiet different...

Thank's anyway
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Chris" <no@spam.com> escreveu na mensagem
news:OQ*************@TK2MSFTNGP11.phx.gbl...
ruca wrote:
hi,

How can I fill some DataTable by clicking in cells of a DataGrid control?

NOTE: I don't want to select a entire row, ok? I must select only one or
more cells...

I have a DataGrid that have some data that I must select what I want and
then by clicking in a Button it will create some records in DataBase.
So I want to construct a DataTable by clicking in DataGrid, for then
allows me to cover this DataTable and create the records in DB.

The example below is used to make it so no column can be selected but
selects the entire row instead. Add it to your datagridtablestyle. Then
you will need to capture the click event in the datagrid (probably should
just be capture the row change instead) and do a datagridhittest on it.

Hope that helps
Chris

FullDisclosure: This was used from some website... No idea who
Public Class DataGridNoActiveCellColumn
Inherits DataGridTextBoxColumn

Private SelectedRow As Integer = -1
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal
bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal
instantText As String, ByVal cellIsVisible As Boolean)

'make sure previous selection is valid
If SelectedRow > -1 And SelectedRow < source.List.Count + 1 Then
Me.DataGridTableStyle.DataGrid.UnSelect(SelectedRo w)
End If
SelectedRow = rowNum
Me.DataGridTableStyle.DataGrid.Select(SelectedRow)
End Sub

End Class

Nov 19 '05 #3
Hi,

Someone have any idea how can I do this?!?!?!?!?!?!
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"ruca" <ru***@iol.pt> escreveu na mensagem
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi,

How can I fill some DataTable by clicking in cells of a DataGrid control?

NOTE: I don't want to select a entire row, ok? I must select only one or
more cells...

I have a DataGrid that have some data that I must select what I want and
then by clicking in a Button it will create some records in DataBase.
So I want to construct a DataTable by clicking in DataGrid, for then
allows me to cover this DataTable and create the records in DB.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 19 '05 #4

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

Similar topics

0
by: Seiche V via DotNetMonster.com | last post by:
hy. i want to fill a data table from a dataset using SqlDataAdapter.fill(myTable), but i get the error: System.NullReferenceException: Object reference not set to an instance of an object. ...
2
by: pwh777 | last post by:
I need help in understanding the DataAdapter Fill method and how it relates to the binding to controls on a form. I have a table called tbl_CID_XRef on SQL Server. I have written as a test the...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
4
by: Andre | last post by:
I am ruinning this in the global.asa VIA Visual Studio VB .NET (framework 1.1) I have a access database with a table called tblCounters with a feild called Counters with on row of data in it...
2
by: MDB | last post by:
Hello All, I have a data grid that I fill using a dataset. The results of the query has around 15 columns and 500 rows (and growing). The reason I am using the datagrid is so the end users can...
0
by: dalaeth | last post by:
I have searched Google high and low and haven't found anything that works. Here's my problem, hopefully someone will be able to help! I'm using 1.1 Framework, and ODP.NET 9.5.0.7 on a Windows...
2
by: Adrien Reboisson | last post by:
I'm trying to build a basic DB explorer using C# & Visual Studio 2005. I installed SQL Server 2005 Express, created a blank project, dropped a TreeView, a ListView and a DataGridView : DB objects...
2
by: Tina | last post by:
Can I use a sqlDataSource to fill a datatable in code? How? Thanks, T
2
by: Ryan Liu | last post by:
Hi, If I have a very big view in database, it covers 15 tables, each table has 1000 columns. When I issue select * from view, the database will give error -- too many columns. Can I use a...
1
by: David | last post by:
Hi, Using .NET 1.1, C# I am using a provider factory so that my app can use various database types. I am currently using the DataAdapter from the provider to fill a dataset, however, I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...
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,...
0
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...

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.