|
Hello
I am new to VB.net and have a form where I am trying to update an Access database from a datagridview that I databound on the fly. However when I change something on the grid and press the update button it would seem that the dataset has accepted the changes, but when I next look at the grid, it hasn't updated. Can I use a SELECT statement in the way that I have?
Am I doing something wrong in the code, or is there something in the grid properties that I need to change?
Many thanks
Trimtrom
Public Class frmManual
Dim dcManual As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Nwind 97.mdb")
Dim daManual As OleDb.OleDbDataAdapter
Dim dsManual As New DataSet
Dim strSQL As String
Private Sub frmManual_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strSQL = "select * from employees"
Try
daManual = New OleDb.OleDbDataAdapter(strSQL, dcManual)
daManual.Fill(dsManual, "Employees")
Catch ex As Exception
MsgBox(ex.Message)
End Try
Me.dgManual.DataSource = dsManual.Tables("Employees")
End Sub
Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
Dim ans As String
If (dsManual.HasChanges) Then
ans = MsgBox("Changes have occurred!" & vbCrLf & "Do you wish to update?", MsgBoxStyle.YesNo + MsgBoxStyle.Information, "Updates")
If ans = vbYes Then
Try
dsManual.AcceptChanges()
daManual.Update(dsManual.Tables("Employees"))
Catch exManual As Exception
MsgBox(exManual.Message)
Throw exManual
Finally
End Try
MsgBox("Table updated!", MsgBoxStyle.Critical, "Employees")
End If
End If
End Sub
End Class
|
|
|
|
|
Dear All
Hello, How can make a print preview in VB6.0 with API and VB functions. Without any Other .OCX Files.
|
|
|
|
|
Hello!
I have a picturebox (width=60, Height=60) size mode is set to Strechimage. I am loading an image to picturebox which has bigger size and then I want to save this image back to hard disk with smaller size (size of picturebox)?
Can you show me how to do that please?
Thanks!
Bedri
|
|
|
|
|
VB or VB.NET?
---
b { font-weight: normal; }
|
|
|
|
|
|
Use the GetThumbnainImage method of the Image class.
---
b { font-weight: normal; }
|
|
|
|
|
System.Drawing.Imaging.BitmapData
public int Height { get; set; }
Member of System.Drawing.Imaging.BitmapData
Summary:
Gets or sets the pixel height of the System.Drawing.Bitmap object. Also sometimes referred to as the number of scan lines.
public int Width { get; set; }
Member of System.Drawing.Imaging.BitmapData
Summary:
Gets or sets the pixel width of the System.Drawing.Bitmap object. This can also be thought of as the number of pixels in one scan line.
Matthew Hazlett
Sometimes I miss the simpler DOS days of Borland Turbo Pascal (but not very often).
|
|
|
|
|
Hi,
does anyone have the code to create a registry key on a remote PC using WMI in VB.net ?
thanks
|
|
|
|
|
|
the links are for C#. I am looking for VB.net
|
|
|
|
|
C# and VB.NET use the same .NET framework, so the first link still applies.
Also, the 2nd link he provided takes you to a C# to VB.NET code converter.
|
|
|
|
|
whats the advantages and disadvantages between C# and VB.net?
|
|
|
|
|
sentmemail wrote: whats the advantages and disadvantages between C# and VB.net?
Questions like that usually spark religious war like debates.
A search on the Internet and on this website will find many debates on this topic, having all kinds of strong opinions.
In my opinion, other than the syntax, there is little difference between C# and VB.NET. Both languages have nearly identical language featuers and they use the same .NET class framework. I would say that it is to your advantage to learn both languages and doing so would make you a better ".NET developer".
|
|
|
|
|
Use the second link to convert c# to vb.net code.
Good luck
|
|
|
|
|
|
Hi,
how can i get this vbscript code into VB.net?
thanks
Set objShell = CreateObject("WScript.Shell")
strPingResults = LCase(objExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
|
|
|
|
|
This is a guess. You may need to add a COM reference. When I find something that really works I will post again.
|
|
|
|
|
|
If you're using .NET 2.0 (Visual Studio 2005) then you can use this...
My.Computer.Network.Ping
|
|
|
|
|
i am using VS 2003. Where can i get to know what are the classes available for use?
|
|
|
|
|
The .NET Framework SDK on MSDN, click[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Web browser control's Navigate and Navigate2 methods look for either a file on a web server or a local file(htm) on the application root. Is there a possibility to use this by passing a html fragment( say <h2>Hello</h2>) to it?
Simple trial shows you get an Action Cancelled web page with no HTTP errors(possibly it's not http).
|
|
|
|
|
I found the easiest way was just to create a temp file and navigate to it then delete it.
Changing .DocumentText dosn't work except the first time you use it.
Matthew Hazlett
Sometimes I miss the simpler DOS days of Borland Turbo Pascal (but not very often).
|
|
|
|
|
Thanks a lot. The html fragment is only in memory and not in a file. You wll have to call additional programs to commit it to a file before navigating to it. I am looking for a easy way out.
|
|
|
|
|