R – how to get the handle of listbox in vb.net 2005

vb.netwinforms

How to get the handle of a ListBox control in VB.NET 2005?

I am using

Dim i_Handle As ListBox

i_Handle = ListBox1.Handle

But this is not working

Best Answer

You're creating a new ListBox and setting it to be the value of ListBox1.Handle - but ListBox1.Handle returns an IntPrt type - an integer.

 Dim listBoxHandle As IntPtr

 listBoxHandle = ListBox1.Handle
 MessageBox.Show(listBoxHandle) // You'll see numbers.