This is a two part question,
1) The code below should display a form with a datagridview and a few
command buttons. This form should allow the user to make change to the
records displayed
in the datagridview and have to changes written to the Filters table in
an MS Access database. The if the user chooses, clicking on the Restore
button empties
the contents of the Filters table, refills it with the contents of the
DefaulFilters Table, and refreshes the contents of the Datagridview to
reflect that the defaults
have been reloaded. All of this works except the part where the
datagridview gets refreshed. I can close the form and reopen it and the
default data is loaded,
but it is not loaded without closing and reopening the form. How can I
refresh the datagrid view without closing and opening the form?
2) This one may be a bit harder. The code in the Restore sub below was
built by coping, pasting, and modifing examples in the newsgroups as is most
of my code.
If someone has time, could you please write a few lines that explain
what each of the line of code are doing. I follow that a connection to
the database is open,
two DataAdapters are open for each of the two database tables, these
DataAdapters are used to fill two DataSets, and then I get lost.
Thanks for any help with either of the above.
Thomas
Private Sub frmFilters_Load (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load, MyBase.Load
Me.FiltersTable Adapter.Fill(Me .TAMDataSet.Fil ters)
End Sub
Private Sub cmdRestore_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdRestore.Clic k
'This sub empties the Filters Table. Copies the records in the
DefaultFilters table
'and places them them in the Filters Table. Then it refreshes the
datagridviewer with the
'new records.
Dim myConnection As New OleDbConnection (strConn)
Dim ds As DataSet = New DataSet
Dim ds2 As DataSet = New DataSet
Dim tblDefaultFilte rs As DataTable
Dim tblCopyDefaultF ilters As DataTable
'Delete all records in the FILTERS Table
strSQL = "DELETE * FROM FILTERS"
cmd = New OleDb.OleDbComm and(strSQL, cn)
rdr = cmd.ExecuteRead er
myConnection.Op en()
Dim da As OleDb.OleDbData Adapter = New
OleDb.OleDbData Adapter("Select * from DefaultFilters" , myConnection)
Dim da2 As OleDb.OleDbData Adapter = New
OleDb.OleDbData Adapter("Select * from Filters", myConnection)
da.Fill(ds)
da2.Fill(ds2)
tblDefaultFilte rs = ds.Tables(0)
Dim CB As OleDb.OleDbComm andBuilder = New
OleDb.OleDbComm andBuilder(da2)
tblCopyDefaultF ilters = tblDefaultFilte rs.Copy()
tblCopyDefaultF ilters = CType(tblDefaul tFilters.Clone( ), DataTable)
For Each row As DataRow In tblDefaultFilte rs.Rows
Dim newRow As DataRow = tblCopyDefaultF ilters.NewRow()
For Each col As DataColumn In tblDefaultFilte rs.Columns
newRow(col.Colu mnName) = row(col.ColumnN ame)
Next col
tblCopyDefaultF ilters.Rows.Add (newRow)
Next row
da2.Update(tblC opyDefaultFilte rs)
'Clear and refill the dataset and data adapter
'then refresh the datagrid
Me.TAMDataSet.C lear()
Me.FiltersTable Adapter.Fill(Me .TAMDataSet.Fil ters)
Me.DataGridView 1.Refresh()
myConnection.Cl ose()
End Sub
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.c om<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access 0 9693 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RSH |
last post by:
Hi,
I have a situation where I have a DDL that lists all of the tables in a
particular database, and a Datagridview which appears in the same from below
the DDL.. When the user selects a new database table from the list I
refresh the datagridview with the newly selected tables data.
This works fine but after a few tables have been selected it takes a very
long time to load some of the tables. Some tables that contain only one row
of...
|
by: George |
last post by:
Hi,
I have been encountering a refresh problem with DataGridView, which is bound
to a DataTable.
When I make updates (Add, Delete, update) to the DataGridView, everything
flow nicely to DataTable. No problem here.
However, when I add data (programatically) to the DataTable, the
DataGridView does not refresh right away. If I minimize and show my form,
|
by: martin1 |
last post by:
All,
is there window form refresh property? I try to set up window form refresh
per minute. Thanks
|
by: Ivan |
last post by:
I have a class Foo which have two property. I have a thread that do
some process and update class Foo int B. I have a datagridview on main
form. this datagridview data source to this class Foo and column A
binds to string A and column B binds to int B. When i start two
threads, the datagridview able to show two rows and updated int B at
run time. How?
public class Foo
{
public Foo()
|
by: David Cartwright |
last post by:
Hi all,
I'm having a weird time with a call to the Refresh() method of a
DataGridView. I have a VB.NET 2005 Windows application with a main form and
a "worker" thread. The main form delegates a Sub to the worker so that the
latter can refresh the DataGrid after updating the DataTable driving it.
When I run the app under the debugger, everything's fine. But when I run it
for real, it hangs, apparently in the Refresh() method of the...
| |
by: mvenkatesan |
last post by:
Hi guys
I am win appl.
I was bind the datagridview from datatable.
i was changed datas @ runtime. datatable changed but my datagridview not refresh.
I written dagaridview.refresh(); not work
how to refresh?
Thanks in advance
Venky
|
by: MFayaz |
last post by:
Hello!
I have to refresh datagridview when database update , IS there any way to solution that my datagridview auto refresh when any user update database.
Thanks in Advance
|
by: YouPoP |
last post by:
Hi,
I have a Window Form to which i added a datagridview. The binding source is working well, but does not update if the database is modified outside the application (i mean not showing the modification made to the database).
Trying to solve my problem, i added a timer to the form that Fill the datagridview every xx milliseconds (basically a timer that calls the Form_Load method). The timer is working nicely, but because it always refresh...
|
by: Aegixx |
last post by:
Ok, extremely wierd situation here:
(I'll post the code below, after the explanation)
I've got a Windows application (.NET 3.5) that has a single Form with
a DataGridView embedded. The user presses a button to do a SQL query
(fill a DataSet). Before firing the query, I disable the grid/buttons
and turn on UseWaitCursor. After it completes, I re-enable the grid/
buttons, refresh the dataset, then turn off the UseWaitCursor. If I...
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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();...
|
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...
| |
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
| |