I have a question regarding the some data which is being transfered from one form to my class. It's not going quite the way i'd like to , so I figured maybe there is someone who could help me.
This is my code in my class
Public Class DrawableTextBox
Inherits Drawable
Dim i_testString As Integer
Private s_InsertLabel As String
Private drawFont As Font
[Code]...
I've got a form with a textbox( form1) in which the text is being inserted and passed through a buttonclick (al via properties).As you can see I've placed several traces and in the property of the class my trace works fine , however if I look in my Draw function it is already gone.
I have put this code in the global form Inherits System.Windows.Forms.Form. And then in the form that will inherit this from the global Inherits MenuStrip. "MenuStrip" is what the global form is called. But keep getting this error: Error1Base class 'MenuStrip' specified for class 'Lesson2' cannot be different from the base class 'System.Windows.Forms.Form' of one of its other partial types.
eg: dim classobj = xyz("CLASS_NAME") ' where classname is a valid class name and dynamically raising a known method of that class on that newly created object or class reference.
I've been creating short test apps repeatedly to try to understand some of the concepts in VB.NET.For the most part it has been illuminating.I read Bucky's .NET knowlegebase tutorial on passing objects as parameters to newly created forms. He shows how to create a new class that inherits from the base form class and define a New() method with parameters Extending the concept I thought about doing the same thing with a form that was created at design-time (In this case Form2).
I'm trying to get the ATM Class to Instantiate on the Form class.
[code]...
ISSUE = " 'ThisATM' is used before it has been assigned a value. A Null reference exception could result at runtime"
The Other problem i am having is with a class in the program called CardReader. What am i supposed to type to let the code below be able to "read" the read function on the Form1?
I designed a class contains a form that have buttons. When i click any button this function runs
Public Sub BtnClick(ByVal sender As Object, ByVal e As EventArgs) result = CType(sender, Button).Text
[CODE]...
In another project I imported this class. I called the method that shows the form in my class. I need to store the 'result' variable in another variable in the new project. How can It be done.
I've got a pretty general question about the best practice in passing an object reference to a Form in VB.NET. My form is a dialog and I've created an overload ShowDialog method, where I pass an Object into it ByRef.
The trouble is, I want to be able to refer to that Object throughout my dialog Class and not just in the ShowDialog method. For instance, some of my Events for controls on the form, need to reference that object.
I know I could create a local Private variable in the Class and assign it to the passed value, and then use that value. However I'm thinking this isn't very efficient because it would (I believe) create a new copy of the Object (which is a complex, large class in itself).
What is the best way to access a value of a control within a form outside of the form class. I have a lot of functions defined in a module, one of these functions requires a series of values from controls in my main form such as the FolderBrowserDialog.SelectedPath element. I understand that these cannot be accessed in the format form.FolderBrowserDialog1.SelectedPath and that they need to be accessed using a delegate. This is the part I am stuck with.
I had a problem with CLR profiler. But it worked eventually and the results were outstanding. My app took 47 milliseconds to run before and after some adjustments CLR profiler runs in 6 miliseconds! This had to do with String values in a resource file which apparently takes a lot of time. So this got me thinking, isn't it more effective if you would declare 1 String at the top of your class and constantly change it throughout your code? Instead of creating a new String in a method when you need it.
Instead of using: Dim text = "blalblalba" You would do this everytime you needed a string: text = "blalbla"
My question is... What exactly happens when you say text = ""? Does .net create a new String? It looks like you replace the text but what happens in the background? Would it be faster then declaring a new string?
how to set string content as a class instance name?Example. I have an INI-class with many instances like .Path, .Width, etc. Now, i'm reading my ini-file string by string wich hase been written by template:
[code...]
I would like to automate reading an assignment at ONCE. Like cutting the first word in line and setup it as my INI-class instance name.I know how to cut first word, but have no idea, how to set this string as instance name.
I have a function that updates a Client in the database. A client object is passed in, along with a string array of fields/properties that should be updated. I need a way of accessing each property in the client object, based on what is in the array. Basically, I am looking for the VB .NET equivalent to this javascript:
var fields = ["Firstname","Lastname","DOB"]; for(field in fields) {
how find an object's type when it is a subclass of another object and I only know the string value of the object's type's name.
I created the follwing classes:
Public Class word End Class Public Class noun
[Code]...
Using 'TypeOf', I correctly see that pn is a properNoun, a noun and a word. The problem is, using 'GetType' to check pn against a string value, I can only see that pn is a properNoun, not that its parent classes are noun and word.
Is there a way to check pn against the string value "noun" or "word" and get back a positive result, indicating that pn is indeed a noun and a word as well as a properNoun?
How in VB.Net can I extract the value from a string using the RegularExpressions class? For example, say I have the string:[Mon Jan 4 2011] Blah Blah2 Other text and I want to return the "Mon Jan 4 2011" portion in to a variable. I thought you would use the "Regex.Replace" method but I can't seem to figure out how to extract the portion of the string I want.
What I wanted to do was, given the table name (as string), use reflection to instantiate the get method for specific fields (defined as properties with Get and Set methods.
Since the string class does not have a Left method, how would you do this in VB.Net. I could use String.SubString(0, x), but the problem with this method is that it throws an exception if the String is not at least x characters long. Should I use the Microsoft.VisualBasic.Left function instead?
I'm trying to concatenate two properties into one string like so:
public class thing public property word() as string() public property count() as integer()
[Code]....
This is what I want, but it doesn't help that its in the debug output...I need to put it into a single string. I've tried using a_thing.count(i).tostring, but it doesnt work. If I look at the arrays individually, they have exactly the contents I want. But I can't concatenate them. Does it have something to do with suppressing the new line that debug.writeline usually creates?
I'm moving code from code-behind to classes and run into a problem. I have a method which makes a string (an html invoice). In the method a final amount is created. I want to make a class called Invoice which will have the method "CreateInvoice" which will return a string and I also want to set the finalCharge property of the object.[code]
I have created a new class with a string property called "Text".
The property will hold a sentence typed by the user.
I use "KeyPress" event to get the character pressed and use "Console.Text = Console.Text & e.KeyChar" to update the property. Where console is an instance of the class.
The problem is when I press "Delete" nothing happen.
I have a problem of getting the string from the html class. When I debugged the project and I clicked the button, httprequest was connecting to the site then reading the pattern string from html class to get string, but it filled as a blank text.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Create a request for the URL. Dim request As WebRequest = WebRequest.Create("[URL]") ' If required by the server, set the credentials. [Code] .....
I an trying to work regards with the pattern string as "showChannel", which it doesn't filled the string from the html class. I want the pattern string to get the string from the html class such as like this: <p class="showChannel">Name of program - Saturday 26th December, 22:30</p> I want to get the time at the end of the pattern string which I want to fill time like this 22:30.
In my front end project i have a string list of all the control classes. I need to instantiate the class into an object using the string name. How can I do this? The class must be of the right type and not just object?
I need to be able to serialize a class into a string, and I know of 2 patterns:
1) (normal) Serialization pattern
2) Proxy Serialization pattern
I've read [URL] (the only website in google that talks about the proxy-serialization pattern) and still cant find the advantage or benefit of using this pattern. Could someone explain what exactly is the proxy serialization pattern, or rather exactly what problem does the proxy-serialization pattern solves that the normal-serialization pattern doesn't solve?