Manage Pointers In .Net?

Dec 15, 2010

Id'like to pass some variables (string and integers) to a class, and when I call a method of that class, it has to change the original variable.I know it was not impossible in C#, but I'm using VB2010, I made a C# project into my solution, but methods using pointers are hidden into VB. How can I make that kind of change?

An example:

Sub ChangeValues()
Dim A As Integer = 1, Str As String = "Start String"
Dim X As MyClass(A, Str)
X.ChangeInt(2)

[code]....

View 11 Replies


ADVERTISEMENT

Simulating Pointers In .Net?

Jun 9, 2010

have a 2d array of structures that holds about 5 or 6 details on each cell. The array size will not be known at compile time so I am using ReDim to resize it. I also have a list (think I have it as an arraylist actually but shouldn't matter really) that I would like to hold a pointer to one of the 2d array elements (as well as some other info). The list is a much smaller subset of the 2d array. The reason I am doing this is that the list needs to be sorted based on some data in the 2d array that will be changing. I don't want to have to search through the list each time to update the values as these lists and arrays can potentially be very large.

Maybe there is a better way to handle this but even if there is I would like to know how to simulate pointers in VB.Net. I know there are IntPtr's and references that I could probably use but I have no idea how to do it with dynamic arrays of structures. I'm familair with pointers from C++ but this is the first time I have tried to use (or simulate since there seems to be no real support for them) in VB.Net.

Not sure how clear that was so here are some snippets of the data types involved and some initialization.

Code:
'structures that are in the 2d array
Structure SearchNode

[code]....

View 6 Replies

Multidimensional Arrays / Vectors And Pointers?

Oct 15, 2011

I'm looking for something similar to using vectors and pointers that I've used before in C++; unfortunately, it doesn't seem like there's an equivalent function in VB.net.What I have is a copy of the array behind a multi-line Rich Text Box, and I need to separate the words from each line (or element of the array) so I can analyze each one separately.In C++ I would do something like this, so I could continuously expand as needed:

[Code]...

View 6 Replies

Pasing GridView Pointers To Other Forms

Feb 3, 2012

i am new to commercial programing (and this site) I am currently studding Computer science at a university and i have hit my First roadblock.I am currently developing an application that displays a Table on one Form1 in a Read-Only format and a second Form2 which will only be displayed if after selecting a row on the Grid-View of Form1 you press an Edit button.We are doing that to avoid the User editing the DB in large. The Form2 is populated by a details view of the Table with no controls to change row on the table.What i am trying to accomplish is passing the information of which row was selected in Form1 to Form2 thus making it the current row and subsequently the only one been edited. Currently most things work but as soon as Form2 shows (Form2.show()) it will only display the first row of the database.I want to know if there is a way to "sync" the two indexes.

View 3 Replies

Pointers - Accessing Variable Addresses In .NET?

Dec 23, 2009

I have to upgrade a legacy VB6 app to VB.NET; this app uses a function call from a .dll that takes a memory address as one of it's parameters. The VB6 app does this with the VarPtr() function, but this function does not exist in .NET. How do I retrieve the memory location of a variable in .NET?

[Code]...

View 2 Replies

Pointers For A Web Sniffer/auto Responder?

Sep 11, 2011

I'm looking to make a simple web traffic sniffer that will automatically reply toauthentication requests from a predefined source, but I'm not entirely sure how tostart/what I am looking at my self here.I guess it's easier to explain if you have a short backstory;I use WebDAV, but Windows does NOT have good support for this (lacking Basic auth support, and Digest support being flawed at best), so you are forced to manuallyauthenticate with a username and password every time you open a file, when you start your computer or a word document (for example) loads resource such as images (imagine writing yoru username and password for every image in a powerpoint!).

View 2 Replies

Pointers On Doing A Multi-website Search From Within App?

May 19, 2011

have an app where the user can select to search websites I have "Hard-Coded" into the app and select categories and sub-categories to search within those websites.What i need is to figure out how to take a user defined search query (Example: The Holy Bible King James Version), then search the relevant websites (behind the scenes) then output the results something like a google or bing search, then allowing the user to download directly their search query

View 3 Replies

Pointers To Variable - Vb Doesn't Support But C# Does

Jan 17, 2010

Since vb doesnt support pointers but c# does. I am using a wrapper dll that requires a pointer to some singles to be passed within the method. I get an error that the method has some parameter types that are not supported. How can i pass a pointer to this method if vb .net doesnt support pointers.

View 4 Replies

VS 2005 Unmanaged API Using Structures/pointers And ***?

Aug 23, 2011

I am in the process of writing a tool to manage DHCP servers using the DHCP Server API. Its an unmanaged DLL so using it is a PITA at least for me it has been.Currently I am stuck trying to enumerate the IP ranges in a particular IP subnet. I am able to access an array of structures but I have only been able to access the first structure in the array of strucutres.Using this I can sucessfully access the first structure in the array.

Dim element_info_array As DHCP_SUBNET_ELEMENT_INFO_ARRAY
Dim element_data_ptr As LPDHCP_SUBNET_ELEMENT_DATA
...
element_data_ptr = DirectCast(element_info_array.Elements, LPDHCP_SUBNET_ELEMENT_DATA)

However when I use this to try and loop through them one at a time it does not work. The ptr returns 0 is null.

Dim element_info_array As DHCP_SUBNET_ELEMENT_INFO_ARRAY
Dim element_data_ptr As LPDHCP_SUBNET_ELEMENT_DATA
For i = 0 To size

[code]....

The sizeof for DHCP_SUBNET_ELEMENT_DATA could be off due incorrectly setting up the union structure for it. I was not sure how it define it so that only the first ElementType and one of the other components is avalible at any given time. It wont even read the first pointer though so that has not even come into play yet.

<StructLayout(LayoutKind.Sequential)> _
Public Structure DHCP_SUBNET_ELEMENT_DATA
Public ElementType As DHCP_SUBNET_ELEMENT_TYPE

[code]....

View 3 Replies

2008 - Use Different Types Mouse Pointers In .Net For Each Form?

Mar 28, 2009

How Should I Use Diffrent Types Mouse Pointers in .Net for Each Form? How Should I Play a mp3 sound File From "D:My Locationsound.mp3"? How Should I Create an Set up File in VB.Net 2008? How Should I Make a Form Shaped Round? How Should I Use The Mouse as Mouse Touch Event?

View 1 Replies

Passing Pointers Between C And Visual Basic 2008

Oct 27, 2009

I'm trying to call C code in the form of DLL's from Visual Basic. When I do everything passed by value I have no issues. But what I really need is to return multiple pointers to arrays of sizes I don't know at compile time (so I'd have to dynamically allocate that memory). For instance

[Code]...

Here the array sizes are hardcoded but that's for the simple fact I didn't want to copy my whole algorithm over, in my actual code I wont know the array sizes at compile time. So my questions are these:How do I make the function declaration in Visual Basic 2008? How do I free up the memory in Visual Basic that these pointers point to?

View 3 Replies

String Pointers - How To Get Name Output Parameter And Work With It

Jan 27, 2011

My application uses a third party API. This API uses a few functions that returns a value by reference as one of the function parameters. Problem is according to their documentation, the value I am trying to get out of this function is a string pointer.

So if that made no sense, heres an example of the syntax of the function as shown in their documentation:
long ExampleFunction(long ID, long PropNum, char* name, long MaxStringLength)
Input Parameters: ID, PropNum
Output Parameters: name, MaxStringLength

Thats pretty much all the info I've got. Obviously they are not using VB.Net, looks like C to me. I want to get the name output parameter and work with it, but once I get this value, I cant change anything. I know this is because its a pointer (reference type?) but I am still at a loss as to what to do.

View 1 Replies

VS 2010 - Advanced Code Which Uses Threading, Pointers

Mar 30, 2011

I had recently(2 months before ) found some code for locking the screen. Here's the link to that code submission in our CodeBank : [URL]

I wish to get a clear idea of what it actually does. As it is a bit advanced code for me.

Here's the main part of the

CODE:

View 6 Replies

VB - Pointers, Memory Allocation And Reading Writing Data?

Aug 15, 2009

I am using these API functions for my project where I am handling 3 unmanaged DLLs of two external apps, basically all it does is to carry data back and forth between these external applications. The project needs a lot of use of pointers, passing pointers and reading/writing to memory so both applications can talk to each other.

Declare Function HeapAlloc Lib "kernel32.dll" _
(ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long
Declare Function HeapCreate Lib "kernel32.dll" _

[code]....

set of windows API functions for allocating memory, reading and writing to allocated memory, and other required functions to generate required arguments to pass to these API calls?I am up to where I am allocating memory and getting pointer, but I don't know how to go about reading, writing, passing pointers, finding data lengths and reusing memory.

[code]....

View 6 Replies

C And C++ - Function - Extend It So That It Also Returns A Usable Array Of Pointers To Some Structures

Feb 18, 2009

Correct the problems with this function, and then extend it so that it also returns a usable array of pointers to some structures.

The extended version of this function should: Maintain the same "char *" return type which returns a pointer to a usable, for storing a C string, memory buffer.

In addition, also return a usable array of pointers to structures. This array of pointers is of variable and random length, which must be obtained using GetNumberOfSomeSeqsToGenerate(), which is called, ONLY, from within this new extended version of the function.

The type of these structures and the function that should be used to get these structures are defined as follows:

typedef struct {
char* name; /* '\0'-terminated C string */
int number;
} SomeSeq;

[CODE]...

View 2 Replies

Asp.net - How To Manage An IF Statement

Nov 17, 2011

I have a total of 102 values associated with a fieldname called ArrivedFlag.Then I have a TextBox control with an id of txtFlag on the markup page.In my codebehind, I have an if statement that says:

If txtFlag <> "value1" and txtFlag <> "another value" Then
lblMessage.Text ="You don't have the ability to view details"
end if

This works fine.However, given that there are 102 values, I feel that doing an IF statement 102 times is a bit inefficient.

Dim allowedFlags = New List(Of String)()
With { _
"value1", _
"another value"

[code]....

View 4 Replies

Best Way To Manage GUI States

Dec 11, 2011

I was asked by a client to create a tool that would let a user add/modify/delete/read content from a database. The content can be read from TextBoxes.

My question is, what is the best way to manage GUI locks/unlocks for the different states of the program. IE: If I'm in a "insert" mode, some GUI elements should be enabled, and some not. If I'm in the "read-only" mode, a bunch of them should be disabled... etc.

View 1 Replies

Best Way To Manage Strings?

Aug 21, 2010

I am writing a program that uses an array with three columns and a varying amount of rows. I need to load info on a list of files in an archive(specifically: file name, size, path), and I am wondering what the most convenient way to store strings(to be loaded into the array) is.

For example: I tried creating a new .resx file in my project, and writing a function to be executed on form1_load that reads the strings from the .resx file and places them in the array in their correct column, but unfortunately had no success.

I really have no idea how resx files work, I can put strings in them using the resource editor, but I don't know how to retrieve them using resourcemanager.

I would just put the info straight into an array, but it's much easier to update a .resx file when the archive changes than it is to update the code.

Could someone please tell me how to use .resx files in vb.net? Or an easier way of accomplishing my goal?

View 7 Replies

Can't Manage To Add Different Values Together

Feb 3, 2011

I can't manage to add different values together...

TextBoxAnswer.Text = TextBox1.Text + TextBox2.Text + TextBox3.Text + TextBox4.Text

I import decimal values from my SQL Server into the TextBoxes 1-4, which works fine. But when I try to add the values together into another textbox the answer is just the values combined like a string...?The column of the table in the SQL server has a datatype decimal(18, 2)I have also tried to convert the values in the textboxes into int, str, double... Nothing seems to work...

Example:

Answer = 2,50 + 2,50 + 5,50 + 4,50
So,
TextBoxAnswer.Text = 10,00

but, all I get is:

2,502,505,504,50

View 3 Replies

How To Manage Directories

May 29, 2012

I am now convinced there is no such thing using VB 2010 Express. I have read, re-read, studied, copied and pasted code to no end and all I get are error messages galore. It appears there is a big gap between what's on line as far as tutorials and the code that VB 2010 Express will accept. I hate to sound so lost but at the moment I am. I used to program in BASIC and QBASIC. I was a master at opening up ascii text files, reading them in sequential order, sorting, manipulating, then re-writing them. It was all so easy, like this: [code] That's all I want to learn how to do for the moment. But every tutorial or article I find goes off in to wild tangents about How to Manage Directories or it reads the entire text file into one giant object. Or worse, there's some code which looks promising but it won't run under VB 2010 Express or it might run but the author leaves out important parts of the code that have to be declared ahead of the subroutine....you all know what I mean. It can't be this difficult to just read a text file one line at a time, therefore it shouldn't be so difficult to find an accurate and up to date article on this.This is for really rough programming. I don't need an interface of any kind. The user, will not even need to know that anything is happening. I simply want to read text files, manipulate what's in them and then re-write the edited text.

View 5 Replies

How To Manage Tables Or Any Other Way

Jun 8, 2011

im using dreamweaver and i have a table in which i have an image. When i add another table under the table existing it comes right at the bottom. What should i do to that table so i can move it and place it anywhere around the page. displaying my data wherever i want. And another problem is that, when i place something on the top it doesnt show up there it comes slighty away from where i had placed.

View 1 Replies

Manage Another Pc By Program?

Jul 26, 2009

I want to know that what we use to manage another computer.

View 2 Replies

Accessing Manage Code From VBA

Aug 14, 2009

technique for calling VB.NET methods (C# methods as well) from VBA code?

View 2 Replies

C# - How To Create And Manage Several Datasets

Dec 1, 2009

What is the best way for me to have several datasets ?i've thought about creating a routine for creating datasets with a number in their names, each one with the desired data, but that's not very intelligent (although might work)i'd like to create what would be like an "ARRAY OF DATASETS"

[Code]...

(obs, i've done the same code loading one XML to one dataset and it works perfectly, i've gone back and forth more than one time to assure that it isn't just a logical mistake, it's syntax and lack of programming knowlegde.

View 3 Replies

How To Manage A Simple Database

May 4, 2009

How To Manage A Simple Database

View 1 Replies

How To Manage ComboBox And ListBox

Feb 27, 2009

What I want my program to do is to make a selection from the ComboBox and it will be added to the ListBox. If the selection is already in the ListBox, a message will appear.

Note: Project / Properties / Option strict is On
This is my codes, but the If-Else doesn't seems to work.

For Each country As String In lstCountry.Items
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxCountries.SelectedIndexChanged
[code] .....

View 4 Replies

How To Manage Proper Code

Jul 7, 2010

I have data source and table that I can bind to my controls and datagridview. I can add records to data table and i can view on datagridview but I can't update and Delete records using datagrid. I have following code.[code]

View 1 Replies

Manage GSM Modem Response?

Aug 10, 2011

I'm creating a small program in Visual Basic, using Visual Studio 2010, which communicates with a GSM modem via serial port.The connection works, I can even communicate properly with the modem and I can also send sms and mms .. But I can not handle the modem answers ... I'll explain:If I send a command like AT + CSQ modem replies with + CSQ 22.0. This command gives me the value of the signal as a response on a scale of 0-30 ... I can see on the screen (in a dedicated console) but I would like to manage the response in the sense that I would do something like that

IF (answer.text = "+CSQ 22,0") Then
label1.text = "Good"
ELSE
label1.text = "Bad"
END IF

View 1 Replies

Manage Queries In Application?

Jan 6, 2012

I have an application that works together with a SQL database. This database has more than 40 tables and my applican has to extract different situations from those tables.

I have predefined some queries for the situations that I know they need to be in the application.

The idea is that I need kind of a module in which an user can create his own situation based on the tables, views, functions and procedures that already exist in the database. Something like it is in SQL. There has to be a library or something which will read my sql database directly from my application and which allow the user to create his own queries and situations.

View 8 Replies

Manage The Monitor Brightness?

Jul 13, 2010

I am now building a project where I need to regulate the monitor brightness from software using vbnet.I have now put 2 buttons (+ and -) but I cannot adjust brightess monitor from code usinf these buttons!=!=!=!

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved