Which Way Is Better To Declare Parameter
Mar 26, 2011'--------------------------------------------------------
'First
'--------------------------------------------------------
[code].....
'--------------------------------------------------------
'First
'--------------------------------------------------------
[code].....
I am working on a project where I have to import a DLL file into a VB project that was created a few years back. The DLL was created in C++, and looks like:
void CoordinateConversionService::convert( SourceOrTarget::Enum sourceDirection, SourceOrTarget::Enum targetDirection, CoordinateTuple* sourceCoordinates, Accuracy* sourceAccuracy, CoordinateTuple& targetCoordinates, Accuracy& targetAccuracy )
I am an intern at my job, and I haven't had to use this yet, so my understanding is extremely limited, along with my usage of VB (I'm a C++/C# guy). Here are a few questions:
1) Looking at Dllimport, it seems like the last part outside of the parameters is a return type. Example code from another site:
<DllImport("advapi32.dll")> _
Public Function GetUserName( _
ByVal lpBuffer As StringBuilder, _
ByRef nSize As Integer) As Boolean
Is "As Boolean" the return type? If so, I tried using "Sub" and it says "Keyword does not name a type." Hence why I looked into declare, because it seems I CAN return void/sub as a return type.
2) Trying to use the types "CoordinateTuple" and "Accuracy" give me problems, saying that they aren't defined. How do I get around this since I don't think I can really define them, and what about the fact that they're pointers?
I have a list box that allows multiple values to be selected.Here is my query for my gridview
[Code]...
then before the query is run i use to subtract the final , so i dont get an error and i have to use textbox1.text in my query and not the parameter. that is slower and sql injection,
I am using vb .net & crystal report 11 , I m using 4 parameters in crystal report 1 st is "tcomp" , 2 nd is "tled_name", 3rd is "tdt_form", 4th is "tdt_to", the problem is, when I use first 2 parameters it is working well but when I add other last 2 parameter it's shown error message:
' Declare the parameter related objects. '
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
[Code] .....
I am using VB2008 and SQL Server to populate a DataGridView from a SELECT statement. The SQL SELECT uses a parameter to access the requested row, but I get an error "Must declare the variable '@actionid'." Where and how do I declare @acionid? Here is my code (the error occurs on the Fill command):
[Code]...
Following code doesnt work and raise error "A parameter is missing. [ Parameter ordinal = 1 ]".What s wrong with it?I am developing pocket pc application in vs 2008 and sqlce 3.5 sp1.
[code]....
I'm Trying to Call the Stored Procedure which has one input Parameter and one output parameter . VB.net code is below
[Code].....
I want to have a "template" function that can receive different parameter and a type parameter, like:[code]But Vb told me that tupeList is not defined... is there a way I can do that?
View 2 RepliesIs it possible to make a procedure have a single parameter but the values for that parameter are more than one? I have this procedure:
Public Sub autoComplete(ByVal cboCombo As ComboBox)
With cboCombo
.AutoCompleteMode = AutoCompleteMode.Append[code]....
Now I was wondering if there is a way to use it like this:
autoComplete(myCombobox1, myCombobox2, myCombobox3)
Or can I use a procedure like this with 'With...End With'?
I have a method which requires a parameter to be passed in. I would like to use the Addhandler to call the method through a dynamically created button control's click event.
When I include () in the AddressOf, VS complains: 'AddressOf' operand must be the name of a method (without parentheses).
When I exclude the brackets, VS complains: Method '...' does not have a signature compatible with delegate...
My code:
CODE:
One of the things that I think is really cool about VB.NET is how built-in functions and subs have extra help text in their ToolTips like "Expression: String expression to search for replace string." as well as the usual "Replace(...parameters...) as string" text. So are the pop up boxes with things like "CompareMethod.Binary" or "CompareMethod.Text." And finally I like how some functions and subs have different sets of parameters for the same routine. For example, New FileStream() starts with either a path (string) parameter or handle parameter, but none of the 15 sets of parameters contain both path and handle parameters. Is there a way that I can set up the classes and functions I write to use these things or do they only work with built in classes and functions? If there is a way, what are the proper names for them so I can look them up in the VS/VB documentation? I would be happy enough if someone would give me an example of them, but it would be nicer if I could go through the documentation and find out if there are other cool things that are related or near by.
View 3 Replieshave an idea on what i am doing wrong here:
Compiler Error Message: BC30455: Argument not specified for parameter 'dteRDate' of 'Public Sub New(strOName As String, strOAdd As String, intOPhone As Integer, strVer As String, dteRDate As Date, dteWDate As Date, strONote As String, strOrName As
[code].....
I have a vbscript that runs under asp page. I need convert the code to VB.NET
SET objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = Application(DB)
With objCommand
[code]....
What is the VB.Net that will do exactly the vbscript does? I like paramer(0) and 1 and 2 etc since I don't need to define the parameter(0) as integer or varchar etc. I remembered I have discuss this before and it is possible to do in VB.NET?
where i put the *'s i get the error "The parameter 'address' cannot be an empty string. Parameter name: address".
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim mail As New MailMessage()
Dim SmtpServer As New SmtpClient
[code].....
I have a label called "test" in my Index.asp page in my MVC view folder. I want to be able to change the value of it in my controller class.
View 1 RepliesI have this H file in C, which includes[CODE]...
I get an error :FatalExecutionEngineError was detectedMessage: The runtime has encountered a fatal error. The address of the error was at 0x79e71bd7, on thread 0x11f0. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.How do I translate it correctly ?
In C# we do
byte[] imageData = new byte[];
SqlCom.Parameters.Add(new SqlParameter("@ImageData", (object)imageData));
which makes the imageData variable as an object.But How do i do this in Visual Basic??
Dim imageData As byte() = new Byte()
SqlCom.Parameters.Add(new SqlParameter("@ImageData", ?? ) <-----What Should i do here?
My code is like this
conn.Open()
Dim cmd As SqlCommand = New SqlCommand("SELECT PhotoID From Photo " & str8 & " And Photo = @Photo", conn)
cmd.Parameters.AddWithValue("@Photo", CType(Photo, Object))[code]....
It comes out error like this:The data types image and varbinary are incompatible in the equal to operator. What should I do?
To declare an object in JS i can simply do the following:
var house = new Object();
house.window="square"
house.color="green"
In asp.net (VB) if i try doing the same
Dim house = new Object()
house.window="square"
i get an error: System.MissingMemberException: Public member 'window' on type 'Object' not found.
Do i have to create a house class before i can reference house.window? Is there no way to do it without creating a class?
In my VB 6.0 code, I declare have the following line[code]...
However, in VB.NET, I get the error "expecting declaration". Isn't this a declaration statement? Is there a good reference for finding the differences between VB.NET and VB 6.0?
In c++ we declare integer's hex value like this
int myint=0xabcd;
so how to i declare integer's hex value in vb.net
I want to know if it is possible to declare a variable thrice.
[code]...
i am making a program and the program runs too slow, so i would like to declare my functions at once.. not like this :
[Code]...
How to declare a datasource?
View 1 Replieshow to declare a textbox because my computer for a particular textbox say that "is not declared"
View 9 Repliesi know it's probly really easy. but how do i declare App.EXEName
View 10 RepliesI am trying to send mail that is formated as HTML but I get an error showing thatlFormatHtml is not declared. How do I declare it?
View 1 RepliesI need to get the customer name from the user as in combo box when the user selects the user I want that selected customer name should be searched in the sql table (here table name is "obbalance") and all the entries in the table having the name as the selected customer naem it should be shown in the data grid view
cmd.Parameters.Add(New SqlParameter("@p1", SqlDbType.NVarChar).Value = ComboBox1.SelectedItem.ToString)
cmd = New SqlCommand("select obbalance from balance where custname=@p1", con)
dr = cmd.ExecuteReader()
Form2.Show()
After this also it shows a error. It shows error in declaration.
I have created a new class, but I cannot use the textbox in the class as it is in the form1 class how would i declare it or use it in both classes?
i have tried form1.textbox1.text which workings in coding but when running my system it does nothing.
Can anyone tell me how to declare updareresource api in vb.net . i searched pivoke site i didnt found example for vb.net and also show me an example please explaining its parameters
View 16 Repliestrying to figure out how to declare items here. here is the
[Code]...