473,585 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pointer in visual basic

Is it posssible to get the address of a variable in visual basic
I mean something in c++ like
int *ptr;
int a=1;
ptr = &a;

thanks for any help that can be offered,
sriraj
Jan 8 '08 #1
3 2816
sr********@gmai l.com wrote:
Is it posssible to get the address of a variable in visual basic
Why do you want to do that? What are you trying to achieve?

--

(O)enone
Jan 8 '08 #2
On 2008-01-08, sr********@gmai l.com <sr********@gma il.comwrote:
Is it posssible to get the address of a variable in visual basic
I mean something in c++ like
int *ptr;
int a=1;
ptr = &a;

thanks for any help that can be offered,
sriraj
Well... Technically, yes you can. But why do you want it? There
really isn't a lot you can do with it once you have it anyway, and
anything you manage to do is likely to be dangerous anyway :)

--
Tom Shelton
Jan 8 '08 #3
<sr********@gma il.comschrieb:
Is it posssible to get the address of a variable in visual basic
I mean something in c++ like
int *ptr;
int a=1;
ptr = &a;
There is no direct equivalent.

Depending on the situation, one of the following solutions may apply:

* Use references instead of pointers (see: reference types, value types,
operators '=', 'Is', 'IsNot').

* Declare the parameter as 'ByRef' when using p/invoke.

* Use 'Marshal.Alloc* ' to reserve an unmanaged block of memory and then
use 'Marshal.Write* '/'Marshal.Copy' to copy data to the memory area. Then
you can pass around the pointer pointing to the memory location.

* Use 'GCHandle.AddrO fPinnedObject' to pin a managed object in memory
(rarely useful).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 9 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6955
by: pix | last post by:
Hello, I would like to start learning Visual Basic, and I was wondering if there are any recomendations to any ebooks, or actual books for that matter. I have my eye on this book by John Smiley, any comments/suggestions would be greatly appreciated.
2
4222
by: AK | last post by:
I don't want any part of the previous discussion on Visual Basic versus Visual Basic.Net. My query is about using Visual Basic for Applications; and whether it is better to use Visual Basic 6 or Visual Basic.Net as a springboard for studying VBA. I use Office 2000 and would like to use VBA as a tool to customize it. I have zero...
2
3573
by: Ralph | last post by:
I used to have Visual Basic .net std. 2003 installed on WinXP SP1A. But I found it too hard to upgrade WinXP to SP2. Now, I do have WinXP SP2 installed, but I am having problems installing Visual Basic .net standard 2003. Not installing Visual Basic at the WinXP SP1A level - was the only way I found that I could install WinXPSP2. My...
2
4869
by: frossberg | last post by:
Hello! I tried to install the Visual Basic.NET Resource Kit (http://msdn.microsoft.com/vbasic/vbrkit/) but obviously something went very wrong and now it sems impossible both to repair and to remove (to start over from scratch) the installation. The messages popping up after choosing one of these two alternatives Repair/Remove Visual...
4
2151
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a problem. Can they not just post the fix. I see no reason to contact MS since I have most likely sent about 1500 dumps to them and I would think...
97
5465
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in the first place. Anyone else heard about this development? The Master
92
3290
by: =?Utf-8?B?bW9iaWxlbW9iaWxl?= | last post by:
I'm trying to load this structure for a call to DeviceIoControl: typedef struct _NDISUIO_QUERY_OID { NDIS_OID Oid; PTCHAR ptcDeviceName; UCHAR Data; } NDISUIO_QUERY_OID, *PNDISUIO_QUERY_OID; I created the equivalent in VB:
5
1392
by: BillGill | last post by:
Ok, I assume this has been asked many times, but I can't seem to come up with a good Google search to find it. I am trying to learn C++. Specifically I have Microsoft Visual C++ 2005 Express Edition. I am trying to learn it from Ivor Horton's Beginning Visual C++ 2005. My problem comes when we get to pointers. I just cannot seem to...
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7950
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...
0
8212
tracyyun
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...
1
5710
isladogs
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...
0
5389
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...
0
3835
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...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2343
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
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.