|
I am trying to delete any row selected using
<br />
Dim SelectRow() As DataRow = DS.Tables(0).Select()<br />
DS.Tables(0).Rows.Remove(SelectRow(0))<br />
But Since i have the selected row set to row 0 it only deletes row 0.
is there something I could put in the place of 0 to represent any selected row so that it will stop deleting only row 0?
thanks
|
|
|
|
|
hi; try this
DS.Tables(0).Rows(datagrid.SelectedIndex)
when you select any row in DG you can get the selected index and can use it to have the row from DS
thanx
|
|
|
|
|
Im confused because when I entered this the whole thing was underlined.you already know what that means im sure. should I be entering it elsewhere or what.
I greatly appreciate the time you are sparing to help me.
|
|
|
|
|
dear
use it where you need, i gave you the way to get any selected row in grid so use it in any method such as (dag.selectedindexchange) to get the selected row or the id or any thing
thanx
|
|
|
|
|
How can fetch data from .DBF data file(FoxPro)with VB6?
|
|
|
|
|
There is a ODBC driver which works with .dbf files. I think its called something like "Microsoft dBase driver" and can be downloaded somewhere on msdn. With it you can then access those files with the normal ADO mechanisms.
|
|
|
|
|
My Project is "Car Rental".
I hve the following doubts while designing and coding my work. I have one table called "Avaliablity" where i used to record information about the booked cars.
I am doing my project on car hire. Meanwhile i came across your site. Its really great. I have some questions too.
1. Once a customer booked a car am trying to put one entry in to 'Avaliablity Table' . So do i hve to refer this table in future if a second customer comes and demand the same car.
2. Also how can i keep the transaction table. i mean the "Booking Table" . Do i hve to keep the particular record open until the customer clear his amount or payment for the car rental.
3. I hve a GUI screen to add new vehicle to the Car rental agenty. do i hve to hve Edit option in the GUI screen for the "Vehicle Table". If so i should allow them to update the mileage only.
4. Do i hve to add "Payment Options" to my project.
|
|
|
|
|
Hi all,
I would like to insert all records found in my datagrid into my table. The following code works but then there are limitation.
I am using a For next loop to insert the rows from teh grid.
The problem is if there less than 21 records then VB throws this error:
No row at index.
Can some one help mewith this.
Tnx
Here is the code for Button_click
Dim da As New OleDbDataAdapter()
Dim da1 As New OleDbDataAdapter()
da.SelectCommand = New OleDbCommand()
da.SelectCommand.Connection = conn
da1.SelectCommand = New OleDbCommand()
da1.SelectCommand.Connection = conn
If conn.State <> ConnectionState.Open Then conn.Open()
da.SelectCommand.CommandText = "Delete from Test where rectp = 'SH' and pkey = '001'"
da.SelectCommand.CommandType = CommandType.Text
da.SelectCommand.ExecuteNonQuery()
Dim Icount As Integer
For Icount = 0 To 20
If DBgrid2.Item(Icount, 0) <> "null" And DBgrid2.Item(Icount, 1) <> "null" And DBgrid2.Item(Icount, 2) <> "null" And DBgrid2.Item(Icount, 3) <> "null" Then
da1.SelectCommand.CommandText = "insert into Test values('SH','" & Format(vBcust, "0000000") + Format(vSeqno, "000") & "'," & Icount & ",'" & DBgrid2.Item(Icount, 0) & "','" & DBgrid2.Item(Icount, 2) & "','" & DBgrid2.Item(Icount, 3) & "')"
da1.SelectCommand.CommandType = CommandType.Text
da1.SelectCommand.ExecuteNonQuery()
End If
Next
|
|
|
|
|
hi
why don't u bind the table with datagrid like this
datagrid.datasource=DATAADAPTERUSED
datagrid.datamember=TABLENAME
then u will only need this command to update ur table
DATAADAPTERUSED.update(TABLENAME)
|
|
|
|
|
I could not understand the solution.
Can you pls explain in detail.
Tnx
|
|
|
|
|
Hi.
I’ve been trying to create an app witch can stream live from a webcam to a file.
I'm using the avicap32.dll.
But all attempts have failed due to the callback function.
I keep getting errors like:
Object reference not set to an instance of an object
Do any of you know of a working example???
|
|
|
|
|
Never mind. Made it work.
|
|
|
|
|
Hi all,
I am doing my first setup project for the addin I wrote and can't solve following problem.
I want to deploy an addin for Visual studio. So I need to look in registry for the HKLM\SOFTWARE\Microsoft\VisualStudio\7.X\InstallDir (where 7.X is 7.0 or 7.1) and take it into MyPATH0 and MyPATH1 variables. For the installed version(s) I need to make TARGETDIR to MyPATH0\..\..\\Vc7\VCWizards.
I have no idea how to solve this. Setup wizard seems to have very simple logic, so how can I program in the wizard
"
1.TAKE REGISTRY KEY XX\7.0 into VAR
2. If success Make VAR+AAA to the TARGET DIR
3.Install
4.TAKE REGISTRY KEY XX\7.1 into VAR+AAA
5. If success Make VAR to the TARGET DIR
"
Thank you very much for your help,
Boni
|
|
|
|
|
Hi.
I can't seem to get my¨callback function to work... plz help.
This code will throw an error:
Public Function myCallBack(ByVal lwnd As Long, ByVal lpVHdr As Long) As Boolean<br />
<br />
Dim VideoData() As Byte<br />
Dim gh As GCHandle = GCHandle.Alloc(lpVHdr, GCHandleType.Pinned)<br />
Dim AddrOflpVHdr As IntPtr = gh.AddrOfPinnedObject()<br />
<br />
' The error come's here.<br />
Dim VideoHeader As VIDEOHDR = CType(Marshal.PtrToStructure(AddrOflpVHdr, _<br />
GetType(VIDEOHDR)), VIDEOHDR)<br />
<br />
gh.Free()<br />
<br />
End Function
The error is:
An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module.
Additional information: Object reference not set to an instance of an object.
|
|
|
|
|
Marshal.PtrToStructure(ptr,structure) is a Shared Sub and doesn't return a value. Try this revised code. I can't test it live but this is what i suspect is wrong with your code.
Public Function myCallBack(ByVal lwnd As Long, ByVal lpVHdr As Long) As Boolean
Dim VideoData() As Byte
Dim gh As Runtime.InteropServices.GCHandle _
= Runtime.InteropServices.GCHandle.Alloc _
(lpVHdr, Runtime.InteropServices.GCHandleType.Pinned)
Dim AddrOflpVHdr As IntPtr = gh.AddrOfPinnedObject()
Dim VideoHeader As New VIDEOHDR
Marshal.PtrToStructure(AddrOflpVHdr, VideoHeader)
gh.Free()
End Function
|
|
|
|
|
This error appeares when it comes to:
Marshal.PtrToStructure(AddrOflpVHdr, VideoHeader)
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: The structure must not be a value class.
The structure look like this:
<br />
Structure VIDEOHDR<br />
Dim lpData As Integer '// address of video buffer<br />
Dim dwBufferLength As Integer '
Dim dwBytesUsed As Integer '// see below<br />
Dim dwTimeCaptured As Integer '
Dim dwUser As Integer '// user-specific data<br />
Dim dwFlags As Integer '
<VBFixedArray(3)> Dim dwReserved() As Integer '// reserved; do not use}<br />
<br />
'UPGRADE_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1026"'<br />
Public Sub Initialize()<br />
ReDim dwReserved(3)<br />
End Sub<br />
<br />
End Structure<br />
|
|
|
|
|
I found a WebCam class here's a link "http://dotnetjunkies.com/WebLog/principal/articles/32662.aspx" it's in C# but you can either convert it to vb or compile it as a .dll and use it that way.
This is the structure I pulled out of the class example in the link above.
<code>
<StructLayout(LayoutKind.Sequential)> _
Public Structure VIDEOHDR
<MarshalAs(UnmanagedType.I4)> _
Public lpData As Integer
<MarshalAs(UnmanagedType.I4)> _
Public dwBufferLength As Integer
<MarshalAs(UnmanagedType.I4)> _
Public dwBytesUsed As Integer
<MarshalAs(UnmanagedType.I4)> _
Public dwTimeCaptured As Integer
<MarshalAs(UnmanagedType.I4)> _
Public dwUser As Integer
<MarshalAs(UnmanagedType.I4)> _
Public dwFlags As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst := 4)> _
Public dwReserved() As Integer
End Structure 'VIDEOHDR
</code>
|
|
|
|
|
I've found the problem: the garbage collector.
Solved it by using GC.KeepAlive()
Thanks for you help.
|
|
|
|
|
I am trying to add a delete button. I need it to delete the selected row in a datagrid. My Dataset is called as DS.I am working with an xmlfile.I already have an add button that is functioning properly:
<br />
Dim myRow As DataRow<br />
<br />
myRow = DS.Tables(0).NewRow()<br />
<br />
myRow(0) = TextBox1.Text<br />
myRow(1) = TextBox2.Text<br />
myRow(2) = TextBox3.Text<br />
myRow(3) = TextBox4.Text<br />
myRow(4) = TextBox5.Text<br />
<br />
DS.Tables(0).Rows.Add(myRow)<br />
<br />
TextBox1.Clear()<br />
TextBox2.Clear()<br />
TextBox3.Clear()<br />
TextBox4.Clear()<br />
TextBox5.Clear()<br />
I just need the delete button. any help would be greatly apprecitated.
|
|
|
|
|
Datagrid? or Dataset?
I am assuming you mean you want to delete a row from your dataset. If that is the case, you first need to know what row you want to delete. once you know that, you should be able to do DS.Tables(0).Rows.Remove or .Delete. Can't remember off the top of my head.
Are you displaying this data in a datagrid object? If so, you will need to capture the id of the row you are on, and will then want to utilize the ItemCommand event of the DataGrid.
Levi Rosol
Blog By Levi[^]
|
|
|
|
|
I want the user to be able to delete any row selected. Yes the data is displayed in a datagrid. how do I capture the ID?
And just as a little memory refresher its Remove.
thanks for the help.
|
|
|
|
|
hii guys..I have a simple question.I havent got a clearly guide about how to connect with database in mysql using vb yet.Please explain to me step by step.thanks 4 ur help
|
|
|
|
|
Try to check the information from here.[^]
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
When I create a thread in my VS .NET application (Dim trdSocket As Thread = New Thread(AddressOf Socket.Listen)), when I close the application with the X in the top right corner, my application still in the list of process... I guess I need to kill the thread when I exit the program ? Which event do I need to use and with which method of the Thread class I can kill the thread ?
Thanx a lot!
|
|
|
|
|
Hi.
I use this.
<br />
Protected Overrides Sub OnClosing(ByVal e As System.ComponentModel.CancelEventArgs)<br />
trdSocket.Abort <br />
End<br />
End Sub<br />
|
|
|
|