473,804 Members | 4,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1298
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 datagridtablest yle.
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 DataGridNoActiv eCellColumn
Inherits DataGridTextBox Column

Private SelectedRow As Integer = -1
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows. Forms.CurrencyM anager, 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.Cou nt + 1 Then
Me.DataGridTabl eStyle.DataGrid .UnSelect(Selec tedRow)
End If
SelectedRow = rowNum
Me.DataGridTabl eStyle.DataGrid .Select(Selecte dRow)
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******** *****@TK2MSFTNG P11.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 datagridtablest yle. 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 DataGridNoActiv eCellColumn
Inherits DataGridTextBox Column

Private SelectedRow As Integer = -1
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows. Forms.CurrencyM anager, 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.Cou nt + 1 Then
Me.DataGridTabl eStyle.DataGrid .UnSelect(Selec tedRow)
End If
SelectedRow = rowNum
Me.DataGridTabl eStyle.DataGrid .Select(Selecte dRow)
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******** ********@TK2MSF TNGP11.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
1777
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. more of the error i get: at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState oldState2, DataViewRowState newState2)
2
2109
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 simple code below: ---------------------------------------------------------------- Private cob As SqlCommandBuilder Private con As SqlConnection Private cur As CurrencyManager
10
6544
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 have one querie that grabs all of the id's I need for the other 4 queries, but I am not sure how to get them into a DataTable or DataSet, or if that is the best way to do this. Seperately the queries all work with no problems.
4
3217
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 with a number. When I run the following code Imports System.Data Imports System.Data.OleDb Sub Session_Start......
2
5232
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 auto sort and page so I would like to keep using the datagrid. My problem is that when I call DataAdapter.Fill, it takes a very long time and is even causing the web page to time out. Does anyone know why the fill is taking so long (15-20 sec)...
0
2151
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 2003 Server. I have a cached DataSet that I fill using an OracleDataAdapter. Changes are made to that dataset in memory and as rows are changed, they are updated back to the database using OracleDataAdapter.Update(DataRow). Every few minutes, I...
2
16898
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 (Databases, tables, SPs, and so on) are displayed in the tree, table colums definitions in the list and I want to display the selected table content in the DataGridView. So far so good. Currently, I succedded in loading the treeview and the...
2
5212
by: Tina | last post by:
Can I use a sqlDataSource to fill a datatable in code? How? Thanks, T
2
2982
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 DataAdapter fill DataTable couple times? For example, I only read 5000 columns from the view each time and I read 3 times. It has an id
1
3006
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 would prefer to just populate a datatable. However, when I try to fill my DataTable, I get
0
9706
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
9579
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
10575
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
10330
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
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
9144
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
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
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.