|
Is this a bad question? Can I explain it in a different way?
Hope someone can help
Thanks
Richard
|
|
|
|
|
Hi,
I am getting "Stack Overflow at line 101" error when I try to view all the contents of a DataGrid by clicking view all, can anyone please provide some solution on this error.
|
|
|
|
|
Stop overflowing the stack !!!
Is any of your code recursive ?
|
|
|
|
|
No my code is not recursive.......
Actually when I populate Datagrid then i don't face any problem,
but when I tried to view all the contents of Datagrid then it shows this error, so I think it is somthing Datagrid related problem,
Please help me at earliest.
|
|
|
|
|
Well, given that lots of people use the datagrid, I assume it's a problem with the code that you're yet to post, crippling any attempts people may here make to help you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi All,
We are porting the following VB 6 code in to VB.net
VB 6 Code:
NumChan = GetDppData(objDppApi, VarPtr(DataBuffer(0)))
Here GetDppData is the function declared as below
Public Declare Function GetDppData Lib "DppApi.dll" (ByVal objptr As Long, ByVal DataBuffer As Long) As Integer
Where DPPApi.dll is a registerable COM Dll.
VB.net code :
UseDll.DppApi.GetDppData(objptr, VarPtr(dp4DataBuffer(intMcaChannelCount)))
Where the above function is declared in a module with name UseDll as below
Public Declare Auto Function GetDppData Lib "DppApi.dll" Alias "GetDppData" (ByVal objptr As Integer, ByVal DataBuffer As Integer) As Integer
VarPtr function Definition in VB.Net is as below
Public Function VarPtr(ByVal o As Object) As Integer
Dim GC As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(o, System.Runtime.InteropServices.GCHandleType.Pinned)
Dim ret As Integer = GC.AddrOfPinnedObject.ToInt32
GC.Free()
Return ret
End Function
Here the functionality that we are woking is :
We are passing the Address of array to the dll so that it can fill all the array elements using Base address of the array.
The VB 6 code is working fine.
In the case of VB.Net code array is not getting initialized.
Please Guide me How to proceed
Varma
|
|
|
|
|
Public Function VarPtr(ByVal o As Object) As Integer
Dim GC As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(o, System.Runtime.InteropServices.GCHandleType.Pinned)
Dim ret As Integer = GC.AddrOfPinnedObject.ToInt32
GC.Free()
Return ret
End Function
The most obvious reason why this doesn't work is because you're pinning the object, getting the address of it, then releasing the pinned object so it can get moved, before you even return the address. That address is no longer valid once the pin is released by GC.Free .
You really shouldn't be passing the address of this array yourself. You should be relying on the Marshal abilities of the Framework to pass parameters back and forth for you and in the correct format.
Default Marshaling for Arrays[^]
Marshaling Arrays of Types[^]
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave Kreskowiak,
Thanks for your Reply,
can I pass the Base address of the array before calling GC.free.
i.e. I will get the base address from the VarPtr and I will call GC.free in another function.
I will check this once i go to site.
Thanks for your Valuble information
Varma
|
|
|
|
|
No, you can't. That's what passing ByRef is for. You're stuck on VarPtr when it's such an outdated concept and is creating more work for you than you really need to be doing.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
check for
ADODC.Parameter class
hope this works...
Nitin...
|
|
|
|
|
i came across this error(No value given for one or more required parameters) in 2 of my buttons both got to do with DB. But i am unable to find a solution to that. Can anyone help me???
|
|
|
|
|
Sounds like you're calling a proc and failing to provide the parameters it needs, based on the limited info you posted.
|
|
|
|
|
This is one of my button can u take a look and is there a problem here???
Dim sqlStr As String = ("Select * from EventTable")
Dim StrActionName As String = ""
Dim dTable As DataTable
Dim db As New DBController
dTable = New DataTable()
db.Connect("PCMgr.mdb")
db.retrieveDTable(sqlStr, dTable)
Dim TReader As DataTableReader
TReader = New DataTableReader(dTable)
While TReader.Read
StrActionName = dTable.Rows(0)("ActionName")
If StrActionName = TxtActionName.Text Then
db.Connect("PCMgr.mdb")
db.InsertRecord("Delete from EventTable where ActionName = " + TxtActionName.Text)
db.Close()
End If
End While
End Sub
|
|
|
|
|
Well, for a strt, your string in
Subjugate wrote: db.InsertRecord("Delete from EventTable where ActionName = " + TxtActionName.Text)
is not in quotes. For second, I have no idea what DBController does, but InsertRecord doesn't seem like the method to call with a line of SQL for deleting records. Either way, I would never write an app like this, it is nasty. I'd use stored procs, and a clear data layer.
|
|
|
|
|
Sorry i dun quite understand u... For do u mean by not in quotes?
|
|
|
|
|
Do you know what quotes are ? Passing a string variable using SQL requires the string to be in quotes 'like this'
|
|
|
|
|
oic... Ya i know wat is tt. I already added the quotes in and it works. i think the error is cause by the missing quotes. Thanks a lot..
|
|
|
|
|
Hi, when I programmed in VB6, I use to love the index property of controls. (...button(index).Visable=True... for example) This would let me set properties of multiples contorls in a simple for...next loop. As far as I can see in VB.NET 2003, It's gone. Is there a new way of doing this or was that bad programming practice?
Thanks
Rob
|
|
|
|
|
Most things VB6 did were bad practice
There's a Controls collection on your form. You can access it by index if you want. You can also step through all the controls and look for controls of a type and work with those, if you want to.
|
|
|
|
|
how to use HTML inside a messagebox? In java you can cutomize the messagebox using HTML. can i use this function in vb.net 2003? Thanks
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
No. You can write your own, but that's all.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok thanks for your advice!! cheers
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
hi everybody
I need to get the state of the default video device, I'm making a photo demon and I need to check if the device is available or not avoiding showing the device selection window.
I've searched a lot but didn't find anything related... I would really apreciate any help...
thanks
Regards
Christian
|
|
|
|
|
It depends on what library you're using to communicate with the webcam. But, generally, if the device shows up in the device list, it's connected to the machine. Usually, the only way to tell if the device is available for use (it could be in use by another application!) is to try and open the device to get an image. If the open fails, it's not available.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Well, im using a library that I got from here and it imports the method capCreateCaptureWindowA like this.
[DllImport("avicap32.dll", EntryPoint="capCreateCaptureWindowA")]<br />
public static extern int capCreateCaptureWindowA(string lpszWindowName, int dwStyle, int X, int Y, int nWidth, int nHeight, int hwndParent, int nID);
when I try to start the capture and the device is busy, it shows a device selection window, that's what I'm trying to handle. If the device is already taken by another application , I want my program to detect it and don't take any picture.
Thanks in advance
Best regards
Christian Arenas Díaz
|
|
|
|