MyClass Equivalent Behavior In C#
Jul 26, 2011
The MyClass keyword behaves like an object variable referring to the current instance of a class as originally implemented. MyClass is similar to Me, but all method calls on it are treated as if the method were NotOverridable. I can see how that could kind of be useful, in some specific scenarios. What I can't think of is, how would you obtain the same behavior in C# - that is, to ensure that a call to a virtual method myMethod is actually invoked against myMethod in the current class, and not a derived myMethod (a.k.a in the IL, invoking call rather than callvirt)?
View 3 Replies
ADVERTISEMENT
Nov 24, 2010
I have a list of properties and values that i'd like to use to dynamically build an Expression(Of Func(Of MyClass,MyClass))
I can run through the list and create each Expression by itself, but the only way I know how to combine them would be to use Expression.And or Expression.AndAlso, but that returns a BinaryExpression rather than my original Expression(Of Func(Of MyClass,MyClass)).
View 1 Replies
Dec 2, 2010
In C# .NET 3.5, is there a way to instantiate an object given its string name? For example, suppose I have a DLL (e.g., MyClass.DLL) which contains type MyClass. Is possible to write something like... Object myClass = SomeMethodToInstantiate("MyClass"); // ? Is it possible to do this in VB .NET 3.5?
View 2 Replies
May 17, 2011
It's a simple concept, but one I've never been taught
View 1 Replies
May 17, 2010
In what scenarios would one use the MyBase and MyClass keywords in VB.NET?
View 5 Replies
Nov 3, 2009
i have a code like this
'bug_message is a public shared property
Public Shared Sub bug(ByVal bug_message As String)
msgbox(XX_format(MyClass.bug_message, bug_message))
End Sub
however i get this error: MyClass is valid only within an instance method. I do not wish to use the actual name of my class, and if i could i would prefer to keep the name of the argument as bug_message as well.
View 18 Replies
May 7, 2010
I'm using VS 2010 so I have auto-implemented properties.I have a class and I want to access the properties by a string.[code]But, I also want to be able to access the variables something like this way.[code]How can I setup MyClass to work both ways?
View 7 Replies
Sep 14, 2011
Is there a simple way to remove Objects from a List by using a specified value?I add 2 persons to a List, how can now I remove a person by a name without using any Loops? (if possible)
[Code]...
View 3 Replies
Mar 13, 2009
I am trying to use myclass.cs from aspx.vb but receive error "myclass not declared" when I give command:
Imports myclass
View 3 Replies
Oct 6, 2009
I'm getting a: mypage.aspx.vb(390,0): error BC30002:Type 'MyNamespace.MyClass' is not defined when I try to compile, run, etc. my website. What's really odd is that I don't have anything in my Error List before or after I do this. I wouldn't have an idea of what was wrong, except I have my compile verbosity turned way up. The line it's failing on looks like:
[Code]...
View 1 Replies
Mar 16, 2010
Traditionally, class/type name is literally spelled inside its definition.
Public Class MyCustomClass
Public child As MyCustomClass
Public Shared Function Clone(ByVal original As MyCustomClass) As MyCustomClass
End Class
This is not a problem most of the time; C-languages even use class name as constructor methods' name. But consider a generic declaration:
Public Class MyListOfIntegers
Inherits MyCustomList(Of Integer)
End Class
[code]....
This scenario has 2 issues. The first one is that constructors are not inherited, and you have to provide pass-through wrappers in every derived class, — this is quiet dumb, but tolerable. The second issue is more severe: derived class inherits CloneMe() method which returns MyCustomList(Of Integer) , not MyListOfIntegers ! Every returned value must be manually DirectCast 'ed for further use with methods that expect MyListOfIntegers . This issue, together with the first one, renders inheritance of generic class almost useless.
So I need a "MyClass" alternative for static type-binding inside type definition. In case of generic type that is referencing other compound types, task could be accomplished by adding second parameter to type section:
Public Class MyCustomList(Of T, TList)
...
Public Function CloneMe() As TList
[code]....
But since we must reference our own type, it would create an infinite recursive loop of additional typeparamlist arguments. How can this be resolved, aside of creating separate classes without generics?
View 11 Replies
May 7, 2010
I can't seem to find the correct words to search for an answer. I'm using VS 2010 so I have auto-implemented properties.I have a class and I want to access the properties by a string.
Public Class MyClass
Property Prop1 As String
Property Prop2 As String[code].....
But, I also want to be able to access the variables something like this way....
Dim MyVar = New MyClass
MyVar.Items("Prop1") = "Prop1 Value"
MyVar.Items("Prop2") = "Prop2 Vaule"
How can I setup MyClass to work both ways?
View 1 Replies
Feb 22, 2011
dim oXT As New Generic.SortedDictionary(Of String, MyClass)
[Code]...
View 4 Replies
Feb 5, 2011
If I do this: Dim w As MyClass = otherObject. where "otherObject" is another variable containing an instance of MyClass, I can be sure that w is a completely different variable? I mean, whatever changes I do to w, will NOT affect otherObject, right?
View 2 Replies
Jun 14, 2011
How to use a .Net 3.5 Behavior in WPF .Net 4?
I get this error when I use .Net 3.5 in .Net 4:
Found conflicts between different versions of the same dependent assembly
I can solve problem with double click on that warning but it doesn't work in design view (It works for building well).
View 7 Replies
Jun 29, 2011
I'm writing an in-house intranet application in ASP.NET and VB.NET. My 'customers' are beginner to medium-level users. All of our browsers are IE8 and above, standard.The application works great, except for one thing. The backspace key. When a user types an invalid number into a textbox, a RegularExpressionValidator and ValidatorCalloutExtender fire off and notify the user. Perfect. Except that, when the user closes the popup warning and notices the cursor is still flashing in the textbox, he/she feels it's time to hit the backspace key and delete that pesky field value.
Unfortunately, the browser interprets this action as a desire to go 'back' into the page history. My boss is screaming. His bosses are screaming. I have a headache.So, how can I turn off this behavior? I still need the backspace to eliminate characters in the textbox, but nothing else. Company policy here: Backspace is to delete characters from the screen. Nothing more, nothing less.
View 5 Replies
Jul 8, 2011
Strange vb.NET application behavior/One application e.g. does some recursive operations against a ftp server as it synchronizes a local directory with a remote directory. When this part is finished, recursively I loop through the local directory to compare each individual file with a hash code table file retrieved from remote to be sure the source file and the destination file are identical. The processing speed to me during the coding was really satisfactory, but all over sudden the all over performance has been reduced by factor 3. So what happened was I closed an application named TeamSpeak. As you can guess it took me a while to figure out what was happening. This behavior is reproducible even with other applications like Outlook or Winamp?To make it short: e.g. TeamSpeak is up and running, my application runs 3 times faster than without TeamSpeak up and running ... same code - no changes !!!
View 1 Replies
Sep 10, 2010
I have a combobox in a Windows form. I set the properties of the combobox as follow:
AutoCompleteMode: Suggest
AutoCompleteSource: ListIems
DropDownStyle: Simple
DataSource: some binding source
Problem when user enter value to the textbox and open the dropdown and filter out the dropdown list. When user mouse click an item in the dropdown list, it will not select the item and paste it to the textbox. User uses the down arrow to navigate to the item and click on the "enter" key and it will not paste the selected item to the textbox. The only way to select an item is using the down arrow key to navigate to an item and then "Tab" away and it will paste the selected item to the textbox.I want to be able to use mouse click or "enter" key to select an item from teh dropdown list.I want to set the DropDownStyle as "Simple" so user can think it is "textbox" and start entering value to it.
View 1 Replies
Oct 15, 2009
how to negotiate a dataset via:
For Each dRow In quanDS.Tables(0).Rows
'do something to each row
Next
I now need to figure out now to loop through a subset of the records returned in the dataset - here's a VB6 example I need to convert:
strSQL = "select * from tblDQ order by xid, xcode, xDOS"
rsMaster.Open strSQL, conDB, adOpenDynamic, adLockOptimistic
rsMaster.MoveFirst
[code]....
View 2 Replies
May 18, 2010
My program shows some browser. From a browser user can open maximized MDI form with some report. When user is closing the report, first MDI form with browser is became maximized.
2 forms have same MDI parent. Can I change this behavior to leave my first browser form without maximizing after second report closed?
View 1 Replies
Jan 28, 2010
I have an issue where a ComboBox control will change it's Text value when it is resized. Here is some sample code that I worked up:
Option Explicit On
Option Strict On
Public Class FMain
Private Sub FMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
uxComboBox.DropDownStyle = ComboBoxStyle.DropDown
[Code]...
View 2 Replies
Jan 27, 2011
I currently have a silverlight application which has silverlight class library. The silverlight class library has a WCF service reference which works as expected for small data. However we have come across a problem which is caused by the default value of maxItemsInObjectGraph. We have tested it with an increased value (called from vb app set in behaviour) and it works however we are unsure how to set the value of maxItemsInObjectGraph when it is in a silverlight class library (as it is only defined in the clientconfig file and no services are added to the client). I have seen posts about adding it to the web.config but this only seems to apply when the service is called directly by the app not by a class library?
View 1 Replies
Jul 26, 2011
I am primarily a C# developer; however, I am currently working on a project for a client who preferred VB.net. I have managed to switch over fairly well, with one frustrating exception. When editing a C# file in Visual Studio pressing enter will select an item out of the IntelliSense window and keep the cursor at the end of the selected statement.
However, when editing a VB file, pressing enter selects the item out the IntelliSense popup AND moves the cursor to the next line. I realize that this is a small thing, but it drives me crazy, because it makes it really hard to switch between C# and VB projects.
I have searched for everything I can think of in Google and found nothing. Does anyone know of a way to change the IntelliSense selection behavior?
View 2 Replies
Mar 22, 2009
I have a userControl (.NET 1.1 Winforms) that has a clickable picturebox as a button.Since I have lots of those usercontrols visible at the same time, I thought It could be nice if I just display the picture box when the mouse is over the usercontrol and hide it otherwise.To do so, I handle the MouseEnter and MouseLeave events of the UserControl, hiding and displaying the picturebox. That works fine.But when the clickable picturebox is visible I'm not longer able to click it (the hand cursor is gone and the click event is not firing).After some test, I realize that if comment all content on the MouseLeave handler that do something with my picturebox... this way the picturebox is clickable.I'm not using the correct event?
Here is the code...
Private Sub NodoEstablo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.pictAdd.Visible = False
End Sub
[code]....
Update:If I resize the picturebox on MouseLeave (just to do something) it works.So far, changing Visible and Location in the MouseLeave prevent me for click the picturebox.
View 1 Replies
Jun 27, 2011
I have an unbound datagridview control whose first column is a combo box This contains a list of part numbers.I am having some problems with the datagridview automtically adding a new row when the combo box item is selected.If I select an entry from the data by typing in part number in full in the first row and pressing tab or enter then I get a new row created. No problems.However, if I then START typing a part number in the second row AND click on the part number in the list that is suggested then I DO NOT get a new row.However, if, on the first row I START typing a part number AND click on the part number in the list that is suggested I DO get a new row.
My code is as follows:
Private Sub dgOrders_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgOrders.EditingControlShowing
Try
[code]....
View 11 Replies
Jul 28, 2010
an application from VB IDE (Debug mode) that application run correctly.If I run the same application from EXE (Debug Mode) that application fail.For accuray:I debugged this application (EXE) usin DbgView.exe and I see that the error is in the Application.Doevents.When the application.doevents occurs, the application stop for a long time than restart after long time or if i send some CTRL + TAB on keyboard.
View 2 Replies
Mar 6, 2012
i have a application based on Visual Basic platform.. where Enter key action as Tab key ,, which ease the enter key to move from field to field, rather than the tab key.. its works perfectly in Winxp ... but i'm having problem in Windows7 ultimate..
View 1 Replies
Nov 16, 2011
I have noticed that the immediate window in VS 2010 behaves differently when debugging a C# project and a VB.NET project, although I haven't been able to find any specific documentation of this difference.
For C# projects, I can simply type in any expression, and it will be evaluated and displayed, i.e.
[Code]...
All other expressions exhibit the same behavior, including simple math such as '1 + 2'. Sometimes the error message is different though, as 1 + 2 results in the error 'Labels that are numbers must be followed by colons.'Is there a way to 'fix' this behavior and make the VB.NET immediate window behave more like the C# one? Having to type a ? in front of every statement can be a pain when using it frequently.
View 2 Replies
Mar 10, 2010
I'm using the following to read a serial port. When run it displays the data correctly but stepping through the program I find that it loops through the serialdatarecieved event for each character of the port input rather than reading all of it. So _msg only equals one letter at a time. I'm trying to set a variable equal to the entire input stream but only get one character of it.The end goal is to capture all of the data available on the port when the event triggers so that this data can then be processed. I tried using the bytestoread function, which gets the correct number of bytes to read, and then looped through to read a byte at a time but that didn't seem to work as I expected either. It just kept reading the first byte.
Imports System.IO.Ports
Public Class CommTest
Dim WithEvents SerialPort As New SerialPort
[code]....
View 3 Replies
May 21, 2010
Why might my GetRawData declared function return a correct value when called from my VB.NET application, but return zero when called from my ASP.NET page?The code is exactly the same except for class type difference (Form / Page) and calling event handler (Form1_Load, Page_Load).
Note: In the actual code, #DLL# and #RAWDATAFILE# are both absolute filenames to my DLL and raw data file respectively.
Note: The DLL file was not created by Visual Studio.
Form1.vb
Public Class Form1
Declare Auto Function GetRawData Lib "#DLL#" (ByVal filename() As Byte, _
ByVal byteArray() As Byte, _
[code]....
View 3 Replies