Passing Structure As Argument Through Files / Functions

Jun 21, 2012

I can't get to pass structure as argument through subs/functions in different files of single vbnet project like I use to in earlier MS basic versions.[code]File "mysetup.dat" is reachable and data is saved correctly what I can see with HxD.But read part seem's to not work as expected. Please any help on reliable passing structure as argument without too much public elements based on upper example.

View 1 Replies


ADVERTISEMENT

Send Pointer Of Structure As Argument?

Mar 12, 2012

i need to call this c++ function

HCTRegisterReceiver( &ReceiverInfo, &m_rid )

ReceiverInfo is structure

m_rid is DWORD

this is the stucture in and m_rid variable declaration in vb.net

Public Const WM_USER As Long = &H400
Public Const WM_HCTNOTIFY As Long = WM_USER + 9[code]....

View 7 Replies

Set A Default Value Of Functions Optional Argument To Null?

Aug 4, 2011

How can you set a function optional argument to null? For example, I want to set the optional argument intCode equal to Null. These arguments are used to send to a stored procedure as parameters.

Public Function pubfnc_SetCommentCode(ByVal strFieldName As String, ByVal lngResultID As Int32, Optional ByVal intCode As Int32 = DBNull.Value) As String

View 13 Replies

Argument Passing In C# And .NET?

Jan 14, 2012

In VB.NET, can we pass an original object as an argument without instantiating it? For example, I have two forms in my project formA and formB. Now I have this code.

[Code]...

Apart from this, in VB.NET in any class like formA, if I type formA, I can see all the objects and controls present there but not in C#. Again, I have to make a new instance to see all the controls. This becomes a problem if I want to manipulate two running and working instances with each other. So what basic thing am I missing here?(I am an amateur programmer migrating from VB.NET to C#. Things are going nice and clean expect for the ones I've recently figured out.)

View 3 Replies

Passing A Type As An Argument?

Aug 12, 2010

I'm using VB.NET 2003 with .NET Framework v1.1. I know it's getting a bit old now but I'm stuck with an existing program and don't have the time/knowhow to convert it to anything newer.

My question would probably be solved very easily with Generics in .NET 2.0 but as I can't use that right now, I'd like to know if the following is possible:

I have a load of manager classes which inherit from DictionaryBase and hold collections of my custom classes. For example, I have a Employee class, a Batch class, a Supplier class, etc... and each of these has a Manager classwhich holds a collection of them - eg: my PlantTrayMgr class holds collections of PlantTrays, etc..

I have one particular form where I have to populate loads of comboboxes with the contents of various Manager objects. What I currently do in my form load event to populate comboboxes is this:

Code:
Option Strict On
Option Explicit On
Private _plantTrayMgr As PlantTrayMgr

[Code].....

View 4 Replies

Passing Argument Into Dll Call?

Mar 7, 2010

In my vb.net code I want to call a dll file created by Qt4.

Now everything works fine untill and unless I pass some string argument to the function.

Here is the function in dll file:

const char* QtEngineDll::randInt(char url[])
{
QString result;
/*QTextCodec *codec = QTextCodec::codecForName("UTF-8");

[Code]....

When the function returns some constant value, say if i put result = "Abhijit" then it returns the value properly. But if I want result to return value url the it is returning some garbage values.

View 8 Replies

Passing Argument To Or From A FORTRAN DLL From .NET?

Feb 1, 2010

I have a DLL written in fortran that I know works because I am getting it from a working software package that we use daily. I am trying to call it from anything but am having problems i believe with passing the correctly formatted arguments in and out of it, so i decided to try and access it from a VB program. I chose VB because I have contacted the developer of the software package we are using and he gave me his DLL function call in VB6, even though he is not allowed to show me the FORTRAN source.

Problem is (perhaps, i think) that I am writing in VB.NET, which has different data types than VB6. Can anyone see why i am am having problems. The error i get upon running is: "AccessViolationException was unhandled: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

[Code]...

View 3 Replies

Passing Argument To Shell()?

Jan 5, 2009

I'm designing an interface using visual basic .NET with visual studio tool. In my program I have to call an extern .exe using the function shell() and pass a FileName to it. The problem is that what it passes to the executable is never the file path. My code is this one and I think it should work but I don't know why, it doesn't.

Public Class FormMain
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[code].....

View 15 Replies

Passing Array As Argument?

Feb 28, 2010

When I try to do the same in .net the "array argument" value of the second sub is either Nothing or I get an error saying "Value of type 'String' cannot be converted to'System.Array'."I've tried converting the array to a system.array but it will not hold all the Types of data it needs to hold. (I tried 3 days ago and don't remember what Types would cause an error. My 1st value is a string and the second is an integer and this caused some error.)

View 1 Replies

Passing Url Based Argument

Mar 27, 2011

I have written an application to register a url type extension at startup so in short if user inputs dld:// in any browser it loads my app now, what I want to do I want to somehow move a bit further like if user goes dld://about the application loads and shows the about page

View 5 Replies

Change Variable Value When Passing As Argument

May 18, 2012

is there a way i can do like this in vb.net

[Code]...

what i want is that idx keeps incrementing after each line, without incrementing it on a seperate line.

View 1 Replies

Force Passing Argument Byval?

Sep 16, 2010

I have an old unmanaged dll function and I want to pass an array to it.The dll function expects the array to be passed by reference.Sometimes I can do that and sometimes I need to pass a pointer in a variable.Is it possible to override the declare for the function so that I could pass either the array by ref, or a pointer to it if I need to?

View 15 Replies

Passing Command Line Argument?

Dec 15, 2011

I am a beginner using Visual Studio Express 2010 to create a small console app to use as a utility accompanying another primary app that can pass a command line to the utility. I would like to set it up so that the utility will not run independently but only run and load its only form (Form1) if it is launched by the primary app using a "/run" command line parameter. (I can set up the primary app to launch and pass a command line parameter. I need help with the utility's code.)

The utility already has some VB code, so I need to figure out what code to add to receive and act on the " /run" command line and even more challenging for me, where to place this new code so it works.

pseudo-code:

initial event to read the command line, then if it is " /run" load Form1, else do not open and run utility app.

View 13 Replies

BackGroundWorker Passing Argument In RunWorkerCompleted Event?

Jan 15, 2012

my current solution as you can see is by using shared variable within a class in order to pass a value.

on the form load of my application i called: workerSample.RunWorkerAsync

Dim finalList As List(Of String)
Private Sub workerSample_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles workerSample.DoWork

[Code].....

View 1 Replies

Passing A Array As A Argument To A Javascript Function?

Apr 20, 2011

Im trying to pass a array as a argument to a Javascript function from code behind(vb.net)
Code im trying

[code].....

View 2 Replies

VS 2008 - Passing Class As Argument For Function

Mar 23, 2010

VB.NET is not letting me dance with both feet, or piss with both hands. I've got one foot and one arm tied behind my back at every turn. I want to use this statement in a function:
Return CType(Formatter.Deserialize(FS), DS)
Seems doable, right?

Function ReadFileStream(ByRef FS As FileStream, ByRef DS As Object)
Dim Formatter As New BinaryFormatter
FS.Position = 0
Return CType(Formatter.Deserialize(FS), DS)
End Function

Right? I mean, CType only accepts a class name as the second argument. I can't give it an instance of a class, or it croaks. Yet if I try to pass the class name as the argument to that function:
DataInfo = ReadFileStream(FileStream1, DataStruct)

VB.NET croaks on this, too, complaining that "'DataStruct' is a type and cannot be used as an expression.". It's used as an expression by CType just fine outside of the function. Does the VB.NET legislature provide a clause that allows for a 'Type' to be passed as an argument in a function? Writing all the supporting code ten million times to deserialize a file using CType ten million times in a large application will get very complicated and tricky very quickly. It should be handled by a routine so that any cases and adjustments that come up can be dealt with in one spot.

View 8 Replies

Passing Arrays To Functions?

Apr 18, 2010

I'm trying to pass an array from a 2D Array to a function that takes a 1D array, but each time I do I get the error Number of indices is less than the number of dimensions of the indexed array.. I know using a structure would solve the problem, but unfortunately the assignment is to use a 2D Array instead of a structure. I've declared the 2D array as such:

Const MAX_ARR_SIZE = 63
Public HouseholdCollection(MAX_ARR_SIZE, 2) As UInteger
Const IDENTIFICATION_CODE = 0
Const MEMBER_COUNT = 1

View 3 Replies

Passing Data Between Functions?

Jun 8, 2012

I would like to have custom methods to pass data between function, or to keep it in memory throughout the program.

Example:

Private function info()
Addr1 = addr1.text
Addr2 = addr2.text
City = city.text

[code]....

Could I run this function towards the beginning of the program and use it throughout until the form is disposed? I can't seem to get the information to stick once I get out of the function, I will need to use the same information multiple times throughout the application so I figured if I could make a function to keep the info rather than declaring the 5 lines in every option but anytime I call the method, it fills it correctly then when I get back to the main function the info goes back to 'nothing'. is it possible to pass data around between functions like you could in Java?

View 5 Replies

When Passing An Object As An Argument To A Method, String Properties Are Populated But Integers Are Null

Jan 27, 2011

I have a class and method exposed to a client asp.net app. The class looks like

<DataContract()> _
Public Class Class1
Private v_string As String
Private v_integer As Integer

[code]....

The method is declared as

<OperationContract()> _
Function GetStuff(ByVal bar As Class1) As String

In the client code I create an instance of Class1 and set the values for v_string and v_integer, but using Wireshark to look at the xml being sent to the server only a value for v_string is being sent as part of Class1. I'm guessing this is because it considers the value of v_integer to be null/not set. Here is an example of the client code.

Dim MyService as New Service1.ServiceClient
Dim test as New Service1.Class1
test.P_integer = 1

[code]....

how different types are passed/used since Integer is a intergral type and String is a class, but can't seem to work out what to do to fix the problem.

View 4 Replies

Passing A Pointer To A Structure To A C DLL?

Sep 28, 2010

Private Declare Function src_simple Lib "libsamplerate.dll" (ByVal data As IntPtr, ByVal converter_type As Integer, ByVal channels As Integer) As Integer<br/>
Private Declare Function src_strerror Lib "libsamplerate.dll" (ByVal err As Integer) As IntPtr<br/>
<br/>
<StructLayout(LayoutKind.Sequential, Pack:=1)> _

[code]....

View 1 Replies

Passing Structure To A Form?

Jul 30, 2011

I have a DB with ~25,000 records that I keep in memory, and I need to pass one record to a second form for display.

code snippet follows:

Structure User
Dim First As String
Dim Middle As String
Dim Last As String

[code]....

The second form opens on second screen (Dual monitor) but I'm not sure what I did is correct. I have hit a wall on how to pass the single record from the structure to the form.

View 2 Replies

Passing Structure To Dll File?

Sep 30, 2011

I have the following .dll file created and added as a reference in my calling project; however, being new to vb .net I seem to be having difficulty calling the dll that I created.I want to pass a string to the below function, break that string out into two strings and then return the structure.

Namespace Item_Breakout
Public Class Item_Run_Breakout
Public Structure vbItem_Code[code].....

View 8 Replies

Vb6 - Passing A Structure To Unmanaged Dll?

Feb 22, 2011

I'm migrating some VB6 code to VB.net,the code contains a structure that contains 1d arrays, 2d arrays, and few other variables.The general outline of the Vb.net structure is as under

[code]...

The call to the dll is declared as under Public Declare Sub getState Lib "val.dll" (ByRef state As Test)Elsewhere on this site I realized that we have to "marshal" the structure to allow it to be compatible with the unmanaged code that is about to accept it.However I still receiving runtime errors when running the code, I don't have any clue of how to use the System.Runtime.InteropServices.Marshal class.What would be the correct way to pass this structure to the dll?EDIT: The original VB6 data type is

[code]...

View 1 Replies

Pass A Variable's Name Along With The Value When Passing Through Functions?

Jul 6, 2009

I want to know if it's possible to retrieve the variables name from when it was passed into a certain function. For example, if I call parseId(myId) to a function with the signature parseId(id), i can obviously retrieve the value of 'id'. However, is there any way I can retrieve 'myId' as a string (without passing it as another value)? Specifically in vb.net, but I'm interested in how it would work in any given language.

View 3 Replies

Passing Arguments To Nested Functions?

Feb 11, 2010

topfunction(myarray, yourarray)
dim function topfunction(byval array1() as integer, byval array2() as integer)
dim function subfunction1(byval array1() as integer)

[code]....

View 2 Replies

VB, Passing And Returning Arrays From Functions?

Nov 27, 2009

I ran into an error when trying to do this:

Code: ChartBuffer = GetCurrentChart(ChartBuffer) The error says Conversion from type 'Integer()' to type 'Integer' is not valid.

Apparently I have some type casting issues, the problem is I'm not trying to cast any types at all. I'm trying to set one array chartbuffer equal to the array returned from GetCurrentChart.

[Code]...

In the constructor of this class I am trying to set the buffer equal to the loaded chart because if I try to write information to a buffer that isn't already initialized, and then save it, it will overwrite stuff that might already be saved in the file as 0's or something, and I don't want it to do that. To prevent this from happening I'm simply going to initialize the buffer in the constructor by setting it equal to the loaded chart. Finally after that is all done I can write new information to the buffer and save it to the file without writing a mostly empty buffer (full of zero's) to the chart that is saved with information in it already.

View 4 Replies

VS 2008 Passing Cookiecontainer Between Functions?

Sep 18, 2009

The login process to one of my sites can get fairly long code wise, so i have decided to cut the process up into maybe 3 or 4 functions, instead of all the code on 1 page.

vb.net
Function functionNavigate1(ByVal POST1 As String)
Try

[Code]....

View 4 Replies

Error In Passing Structure Array To Function

Nov 7, 2011

I'm a beginner when it comes to Visual Basic coding and I need some help with an error I'm getting. I'm trying to pass a structure array to a function to figure out a student's grade. I'm getting the error that 'QuizOne' is not a member of System.Array. Here is my code:

[Code]...

View 3 Replies

Print Specific Structure Members When Passing The Name

May 1, 2009

I am trying to figure out how to print specific members of a structure when I only have to pass the structure itself i.e.

Dim Point1 as PointF = New PointF(15,30)
Debug.Print(Point1) ' This will output "{X = 15, Y = 30}" by default

I am trying to figure out how I can do the same with my own strucutres, for example:

Dim Point2 as PointF2D = New PointF2D(15,30)
Debug.Print(Point2) ' This will output "ClassName.PointF2D.Point2"

How can I get my structures, when passed to a print statement, to print specific members of that structure by default? P.S. Please give another way other than overloading the .ToString function.

View 3 Replies

Passing Null Textbox Value To A Stored Procedure (functions)

Apr 9, 2012

i have a stored procedure to insert data into table create procedure insertdata

[Code]...

View 11 Replies







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