Object Arrays - 2 Declarations - What's The Difference
May 23, 2010Dim MyOrders As Order()
Dim MyOrders2() As Order
Dim MyOrders As Order()
Dim MyOrders2() As Order
What's the difference between these two declarations for PInvoking a user32.dll function?The first way, which I've commented out since it gets an error (Type DllImport is not defined"), the second way works. [code]
View 5 RepliesDim wBrowser As New WebBrowserTabControl1.SelectedTab.Controls.Add(wBrowser)I used the above code to add a WebBrowser to a tab, but I have no idea how to use declarations for it after adding it in code. I'm mainly after the
View 4 RepliesThis is just a quick question: Are there any difference between
[Code]...
The Param1 works but param2 failed when passing it to method with object array parameter
Dim param1() As Object = {5, 5}
'And
TextBox2.Text = "5,5"
Dim param2() As Object = TextBox2.Text.Split(","c)
RichTextBox2.Text = CType(InvokeDllMethod(bt, "kayTestDynamicAssembly.KayTestDLL", "Addup",
param1), String)
My main question is that does .NET treat those 2 declarations differently or maybe I am missing something?
Can anyone explain to me the difference between Arrays and Records and supply some code showing the differance between the two, as an example.
View 3 Repliesevrytime i add new controls to a form in vb.net the designer regenerates code and asks me to make corrections, so i have to keep on changing the object declarations to global using the 'global' keyword evertime it regenarates code,especialy dataset objects.how can i prevent this?
View 1 RepliesIf I create a class in VB called Test,I noticed I can instantiate it like:
Dim test As New Test
or
Dim test As New Test()
What is the difference?
I want to know the difference. I have given 2 lines code.
CODE:
Let me know difference between both datatype.
I'm using vb10. I need to use a timer for forms to turn off and on and I was going to use a timer control and I noticed there is a timer class. What is the difference? Should I use the timer class instead?
View 5 Repliesif I created a new object like this Dim sqlconn As New SqlClient.SqlConnection(cs)
and Dim sqlconn = New SqlClient.SqlConnection(cs) Whats the difference?
I've been working in .NET for some time now, but occasionally I still get confused by a disparity between the framework and my prior experience in C++.In .NET, all objects are either value types or reference types. Reference types are allocated on the heap while value types are allocated on the stack (in the current CLR implementation, anyway). I get that. However, at least in VB.NET, you can still define a constructor on a value type.
Public Structure Coordinates
Public x As Integer
Public y As Integer
[code]....
When we can access the public methods via object then why is there need of inheritance.
View 2 RepliesIn VB.Net is there any difference between the following three ways of initializing object variables
Method 1
Dim commandObject As SqlCommand
commandObject = New SqlCommand("MadeUpCommand")
Method 2
Dim commandObject As SqlCommand = New SqlCommand("MadeUpCommand")
Method 3
Dim commandObject As New SqlCommand("MadeUpCommand")
Is one more efficient than the others, or are they effectively all the same?
I have a VB6 program which calls a COM method, passing 2 arrays as parameters and expecting 2 arrays to be populated in response.The code is this, where ItemIDs and ItemClientHandles are the input array parameters and MyItemServerHandles and Errors are populated by the COM object.
Dim ItemIDs(2) As String
Dim ItemClientHandles(2) As Long
Dim Errors() As Long ' Array for returned Item related errors
Dim MyItemServerHandles() As Long ' Server Handles for Items
[Code]...
I need to query an array. I have tried to use LINQ but with no success.
Here is a simplified structure of Insurance
Public Class Insurance
Public _typ As String
Public _numb As Number()
[Code]....
if you are debugging or releasing a projet , vs writes exe or bin files to the bin and obj folder in a release and debug version, are ther differences bewteen these files with the same name in 4 folders ?, eg myproject.exe
View 3 RepliesI`m a beginning programmer, and I`m trying to build my first 100% object. The object would be a USER object, representing rekords from users table in database. The table in the database has 5 columns ->
[Code]...
I used to do this is VB6:
Type Record
A As Long
B As String
End Type
Dim Rec As Record
When I keyed in "Type" in my declarations, I was asked to change it to "Structure". After that, I was not able to define anything inside. So, what do I need to do?
I am at loss with the code shown below. I wish to write the equivalent in ASP.NET 1.1 but have failed.
[code].....
I'm trying to learn more about assembly security (something I have basically neglected until recently because security in general is such a huge topic), and I have a question about CAS assembly level declarations.I get how to use them (basically) and the more blunt points of the subect, but I'm still not clear on where assembly level declarations should be made. Basically, where in the solution do you put:
<Assembly: CodeCodeCode> _
I just wondered if you can or can't save arrays using the settings system object. There seems to be no way of entering it at designtime. It seems implied you cannot create new user settings.subobjects at runtime. I'm looking to find the easiest way to save a populated array of PictureBox's. If the only way is a self/custom made/managed .ini file then I need to know so i can start on that but I was hoping to use some of all this phaff in the new frameworks usefully.
View 3 RepliesPrivate Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
[Code]...
This correctly returns the memory value as string. So yeah, now it's just the Single that's causing issues.
It is my understanding that all modules are initialized and that all their variables are set up prior to MyApplication_Startup. I have code that has worked well for quite some time (XP and Vista).The Myapplication_Startup code references variables and code located in a Module.However, with Windows 7 this does not work.Anny reference to a module (Data, SUB or FUNCTION) throws a Type Initialization error at runtime. How can I correct this behavior in Windows 7?
View 2 RepliesI'm new to programming. I'm using Visual Studio 2010. I'm taking into two introduction classes, VB and C# with .Net. I have seen the enemy and he is me. I hope that someone can please help me with my two errors.
I do not know how I created My.CopyOfMySettingsProperty but I do know they were created when I was trying to create a project by combining my previous four projects.Listed are the two errors from my error list window that I need to correct along with my offending code:
Error 1 'Settings' is ambiguous between declarations in Modules 'Assign5Multi.My.MySettingsProperty' and 'Assign5Multi.My.CopyOfMySettingsProperty'. F:ProjectsVBAVBAssignment4MoviesMy ProjectSettings.Designer.vb 34 13 prjAssign5Multi
[Code]...
I Changed the following: Dim UserFile As New System.IO.StreamReader(sPath & "" & UsernameBox.Text & ".txt")Dim aString As String = UserFile.ReadToEnd() (The code above says that 'UserFile' and 'aString' are Unused variables)
[Code]...
Although I have been programming for many years, successfully, in many different languages, translating my large Word VBA application into VB 2008 Express is driving me crazy. While I understand the theory of OOP and have even been on object-oriented courses, it seems I can't declare my objects correctly and use them in my code. As far as I know, I'm not trying to do more than the "language" is capable of doing, but here goes.
I want to start with "aList" which would be a Collections.Generic.Dictionary(Of String, String) object. Then I want a "bList" which is also a a Collections.Generic.Dictionary object. I would like each bList item to have a few individual simple properties (like a Byte and a String) then an aList instance as well. The application then gets a bList key value from the user, "copies" the corresponding bList item values into a work area, and does the necessary processing using the various bList(aList) / aList(bList) item values from the work area. I say "copies" because I assume that part is simply going to be a pointer copy rather than a long copy of lots of strings. Note that I really don't want to start using arrays here, as the application makes alot of use of Word VBA Dictionaries and I'd like to keep it that way if I can. Incidentally, so far, I have all my global data declarations in a separate Class, not on any of the application's forms.
I have a project that is structured as follows:
[Code]...
I want the module to execute first before anything else, and so I call module.main() from the MyApplication startup event. At about the point that program execution gets to the beginning of module-level declarations in the module, it also starts running though the class-level declarations in the thread classes, but long before the threads are declared or the threads are started in the module code. I can't figure out why it happens! Is there some way of supressing that until later (i.e when those classes are actually instantiated)?
On my main application i have a button which shows an "advanced options" form, if the "debug" is checked i was trying to enable/disable visability of a couple of text boxes on the applications main screen but when i tried:
[Code]...
In VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.
The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?