Is Keyword Same As Object.ReferenceEquals
Apr 13, 2010Is the Is VB.NET keyword the same as Object.ReferenceEquals?
View 1 RepliesIs the Is VB.NET keyword the same as Object.ReferenceEquals?
View 1 Repliesi read it on internet article already, and tested it already. but it didnt show any difference.
View 3 RepliesI have this CMember Class. I Write something like
Dim moMember As CMembe
r
moMember = New CMember
Then I want to set a variable to its CentreId property[code]...
Both are Integers, however a Object Reference Not Set exception is thrown
Is it somehow possible to use the 'With' keyword on an existing object?I would like to do the following using LINQ to objects and can't seem to find a way:
From m as Product in Me _
Select m With {.Match = m.Name.IndexOf(query)} _
Where m.Name.IndexOf(query) > 0
[code]....
I keep having error message at
ArrayGroup(count).dateDate = valueListString(0),
Code:
Structure dataAttribute
Dim dateDate As Date
Dim timeString As String
Dim volString As String
Dim openString As String
[Code] .....
when i compile my code i got "use the new keyword to create an object instance" at this line " accounts1(sd).Name = textBoxUser.Text"
My code is below.
Private Sub buttonSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonSave.Click
If comboBoxAccounts.SelectedIndex >= 0 Then
[Code]....
Private Sub textadd(ByVal sender as Object, ByVal e as System.Windows.Controls.TextChangedEventArgs)
txtfirstname.Text = txtdisplayname.Text
'TODO: Add event handler implementation here.
End Sub
VB is telling me to use the "NEW" keyword to create an object instance. For example: Private Sub ScoreTotal(ByVal sender..., ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
[Code]....
When I run the "MainStudentScores" form and click on a student with three scores separated by the "|", it should give me a Score Total, Score Count, and Average. However it is giving me an error message at "Scores.Add(intPlaceHolder)" This is where VB is telling me to use the "NEW" keyword. Does this make sense?
Use the "new" keyword to create an object instance & Check to determine if the object is null before calling the method. I'm reading text from a text file using the following [Code]
View 9 RepliesUsing vb.net 2008.I have used the "Using" keyword before in C# with objects that implement iDisposable.Can you use that keyword in vb.net also? What are the advantages of the "Using" keyword other than showing the coder when the object goes out of scope.I am under the impression that the "Dispose()" function is called at the IL level when you use "Using" instead of, for examplel, calling the Dispose() in the .net code.
View 1 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 RepliesVB is telling me to use the "NEW" keyword to create an object instance on the highlighted line in the code below, when I click on the button to add a row to the datagrid. Here's my
[Code]...
I am somewhat new to object oriented programming and am attempting to flatten a Linq object hierarchy by using a shim class.how to initalize a derived class with property values from a base class?I have two objects, a base object with about 100 properties, and a derived object which inherits from the base object and adds a few additional properties beyond those of the base object. My simple constructor creates the derived object, but I am looking for a way to initialize the derived object properties with values from the base object.Right now I am using reflection to iterate over the properties individually and I suspect there may be a better way. The following example shows my shim class constructor for the derived class, and two properties:
newProperty1 - a new string property of the derived class
flattenedProperty2 - a new string property of the derived class, copied from a 2nd-level object of the base class
Code example:
Public Class derivedObj
Inherits baseObj
Private _newProperty1 As String[code].......
Is this the correct constructor approach to flatten the object hierarchy using a shim class? My second question relates to initialization of properties in the derived class. The constructor above creates the derived object, but what is the best way to initialize the derived object properties with values from the base object? The following code uses reflection to iterate over the properties individually, but I suspect there may be a better way.
Code example:
' property names are in the string array fieldNames
'baseObjQuery is an ienumerable of baseObj
'derivedObjList is a list of derivedObj[code].....
Is there a simple way to initialize values for the properties in the derived object based upon the values of the common properties in the base object?
Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
End Sub
In VB.net, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?
Possible Duplicate: WITH statement in Java? does anyone know if there is the With Keyword in Java?
View 4 Replieswhy use of namespace and use keyword and declaration of namespace
View 1 RepliesPossible Duplicate:Default value for generics k so while translating some code from c# to vb, i came across the default keyword, and I'm simply replacing it to nothing.
View 2 RepliesIn my current project everyone names variables and methods after what they are and what they do. This is good for quickly understanding the code, but with a lot of long varible names comes some headaches, such as when copying a dataset to an entity/object. So, while you understand the code, the readability still takes a blow.
veryLongVariableName.Id = datasetVeryLongVariableName.Id
veryLongVariablename.Something = datasetVeryLongVariableName.Something
etc.
Using VB.NET's With keyword can help.
With veryLongVariableName
.Id = datasetVeryLongVariableName.Id
.Something = datasetVeryLongVariableName.Something
End With
Now, my question, is there any way of using With, or something similar, but for several variables at the same time? Something like:
With veryLongVariableName As a, datasetVeryLongVariableName as b
a.Id = b.Id
a.Something = b.Something
End With
I'm all for descriptive naming conventions, but they do tend to clutter things. Especially in VB!
I m trying to create a software in vb.net for some genealogists to trace their ancestors History, the users will search for the document in 3 ways
1. reference number from a combo box.
2. By the title of the document.
3. by inserting a keyword from the documents abstract..
i have already loaded the picture. i hav put all in one note pad my reference no., on next line i put my abstract and on the third line i put my path where the document is located.in coding i put all in different array.... making the program read all one by one line wise.i want to make search thru the keyword... means wen user inserts a key word in the textbox the program read all my abstract and then in a drop down it should display the documents that match the keyword.
Its work well in windows 7 but when i run project in windows xp its says i must use New keyword but when i use New its gives error at regkey.GetValueNames and RegistryKey = Registry.LocalMachine and regBaseKey.OpenSubKey("SOFTWAREMyApp", FalseImports Microsoft.Win32[code]...
View 4 Repliesin C# you'd put a @ in front of a reserved keyword. Is there any equivalent in vb .net?
View 1 RepliesI have to serialize/deserialize a class into a JSON string/and return. The JSON Strinig must contain the "error" string (like: {error:"something strange occoured", id:23, result:"xxxxx"}), which specifies the occoured error.
How can i implement a class like:
[code]...
If i do this, the word 'error' is invalid.
I use the Call keyword when calling subs in VB/VBA. I know it's optional, but is it better to use it or leave it off? I've always thought it was more explicit, but maybe it's just noise. Also, I read this on another forum: Using the Call keyword is faster because it knows that it is not going to return any values, so it doesn't need to set up any stackspace to make room for the return value.
View 4 RepliesFirst off let me say that I am essentially new to VB.NET, i.e; still learning. Also, I hope that this is the right place to post this question. In a Project I have a Class module defined as:
Public Class Def
Public Id As String
Public Meaning As String
[Code]...
I have to inherit some legacy code in company, which is written in Visual Basic.NET 7.0 (Visual Studio.NET 2002). I don't have much experiences in VB.NET, and this line of code gets me in trouble:
Public Class Global : Inherits System.Web.HttpApplication
Visual Studio gave this error: Error 31Keyword is not valid as an identifier.C:Documents and SettingsAdministratorDesktopPOManWebApplication1Global.asax.vb414C:...POMan
What is this keyword how can use it?If Page.IsPostBack = False Then
View 3 RepliesI generally use to organize codes below lines;
#Region "Comments.."
#End Region
But when I want to use it in the Function, it gives error ("..are not valid within..."). Are there any keyword to make this in the Function or there aren't? [Code]
I generally use to organize codes below lines;#Region "Comments.."#End RegionBut when I want to use it in the Function, it gives error ("..are not valid within...").
View 2 RepliesI'm still new in VB.net development environment, i've few of the question may need the advice from you guys to see whether i'm in the right track for the development as below condition:Basically my program wrote from this logics:
Condition:
2 log files available in C drive that is C:/BSKYB/Prod.txt
and C:/BSKYB_CWE/many of log files in .txt format
Program Flow:
Step 1: The program will read the last sentence Hexa number from the file "Prod.txt"
Step 2: Once the program detecting the keyword like example "abcde" it will go to another folder which is descript in C:/BSKYB_CWE to look at which text files contains the keyword "abcde"
Step 3: this step will capture the whole line the text info like example 1111 abcde
if in this case, once the abcde detected what is the command i should apply to capture the key word 1111 ?
This is the problem i have encounter right now, i doesn't know how is actually can apply the right method to read the whole text line once the key word is detected
Public Class Form1
' Const ConstBSKYB = "C:BSKYB_CWE.txt "
'Const ConstBSKYBP = "C:BSKYBProd.txt"[code].....
We have a keyword 'app.path' in VB6 What is the equivalent key word in VB.NET
View 1 Replies