Can't Access Form1 From Another Class
Oct 18, 2011
I have a class called class1, in that class i wan;t to write something in a textbox in form1, but it won't let me access Form1.TextBox1.text, another problem is that it won't give me the save dialog in excel, but thats another problem.How can i acces Form1 controls?
Form1 code
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call ThisDrawing.GetFilepath(True)
If Me.TextBox1.Text = "" Or Me.TextBox1.Text = "False" Then MsgBox("Er is geen geldige filenaam opgegeven")
End Sub
[code]....
View 1 Replies
ADVERTISEMENT
Mar 30, 2011
I am getting this error: The class Form1 can be designed, but is not the first class in the file. Visual studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again. What I have done is in the design window I have put Imports System IO right at the top where should I move it too As when I look at the code it is endless with all the Me. info about everything???
_ Partial Class Form1 Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
_ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose()
[Code] .....
View 1 Replies
Apr 29, 2012
When and why do you declare variables in the Public Class Form1 section?
View 1 Replies
Aug 31, 2008
Here is my code: [URL]..The goal is to get file path that was selected by the user in the Form1 class, transfer it to the File class, and do various things from there such word count, syllable count, etc.However Visual Studio says filePath isn't declared in the File Class, even though right above it you can clearly see it is.
View 6 Replies
Jun 2, 2011
Well i meant In Form1 theres an object named NUM in which i have Stored Few values Now i want to use this Object NUM in form2 so that i can display its value in Form2.. ima unable to access it in form2.
View 6 Replies
Sep 9, 2011
Using VB 2008:Situation: A Form1.BackgroundWorker calls a Form1.subroutine. That sub starts a Form1.Timer with Me.tmrOK_BlinkForm.Enabled = True...fires Timer code in event: Public Shared Sub tmrOK_BlinkForm_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrOK_BlinkForm.Tick
Form3.Visible = True
Form3.Label1.Text = gNowButtonDispText
Form3.BackColor = Color.White
Form3.Refresh()
[Code]...
There must be a way to do this, I just need the correct BackgroundWorker Syntax send Stop commad to Form1.Timer from Form3.Click_event...all inside a Form1.BackgroundWorker thread started in Form1.
View 4 Replies
Oct 27, 2009
In my window application, Form1 variable eg. Public str as string. value blank/null when move to Form2 and Back to Form1. How to maintain Form1 varable's value when back to Form1 In vb.net if any one know, reply me soon
View 2 Replies
Feb 16, 2009
I have got 2 forms ----- form1 and form2
i wanted to navigate from form1 to form2. and then close form1
i did the following code.
-sub form1 _ page load
dim form as new form2
form.show()
me.close
-end sub
i also tried -- form1.close() and form1.dispose() but all in vain
Problem is that my form1 is not getting closed
View 7 Replies
Jun 12, 2010
I have an aboutbox1 and form1..I also have a button. When I click the button it runs the backgroundworker. My background worker then opens form1.My backgroundworker doesnt just open it, it does alot of other stuff so don't ask why im doing it like that.My problem:When the background worker opens form1, form1 is not responding.
View 3 Replies
Oct 21, 2010
Which different abount Form1.Close and Form1.Dispose?
View 1 Replies
Feb 18, 2010
For a test scenario I have a dll project. In the project I have 1 generic class 'GlobalData' and 1 form 'form1' in the generic class I would like to make a public shared newForm1 as new form1 the line of code I'm trying is: Public shared newForm1 as new form1 I get the error newForm1 cannot expose type 'form1' outside the project through class 'GlobalData'. I really need to be able to make a public shared reference to form1. Any way to get around this? Background as to why I need to do this: I have several projects that need to use Form1 as a mdi child. I would like to just update the dll and not have to go back and update the same form in 50 projects.
View 4 Replies
Apr 7, 2011
Imports System
Imports System.Threading
Imports System.ComponentModel[code]....
how to declare "smsport" on class smscomms as public so that it can be access in class form1 or button1_click event.
View 5 Replies
Aug 18, 2009
I have some classes, BsfciFile and StudyFlashCard. Bsfci is the extension to which I save my set of flashcards in an INI format. I am currently working to transform my code from using Windows API calls to access the INI to using a IniFile class that I found on the internet. I would like the BsfciFile to have a Array of StudyFlashCard objects, but I would like the StudyFlashCard class to use the IniFile class object contained in the BsfciFile class. I can pass the IniFile from the BsfciFile class to the constructor for the StudyFlashCard class, but I want it to modify the same IniFile as the BsfciFile class has later on.
[Code]...
View 1 Replies
Apr 8, 2010
I need to be able to start with Form1, move to LoginForm, then back to Form1 taking 2 variables and the "values" they have in the LoginForm back to Form1 and using the variables. I start with the main form (Form1) and have the user enter some information. Once they click OK I have the LoginForm open. After they enter their credentials I will check to make sure they are legal users, then go back to Form1 (here is where I need to take the Username and Password with me) to log onto a server using the same credentails from the login form.
View 1 Replies
Jan 9, 2010
I have these code in my project one from my lecture one that i did myself [code]what is the difference between "dim" something as new form than using the form name straightaway?
View 2 Replies
Mar 30, 2010
This is a bit of a continuation from a previous post for which AtmaWeapon was very informative.
Problem:
A parent class has a sub class with various properties. A property of the parent class is a List(of T) with T = the sub class The issue is how to store data in the sub class of the instantiated parent
Some example code (hopefully formatted correctly):
Code:
'=========== Class Definitions =============
Public Class courseClass
Public Class timeTableClass
[Code].....
View 7 Replies
Oct 22, 2010
How do I access the base class inside a derived class?
View 1 Replies
Feb 15, 2011
I have a very simple class that is located within my App_Code folder in my VS2008 web application project. I am trying to instantiate an instance of this class from my code-behind file. Intellisense does not seem to be seeing my class and I am not sure why. I am using VB.NET which I am admittedly not that familiar with as compared to C#. Perhaps I am missing something. I would bet it has something to do with something I am missing in VB.NET.Here is my simple class (for testing):
[Code]...
View 2 Replies
Jan 12, 2012
Is it possible to set a variable in my custom class for Private Read/Write access and Public Readonly access without creating Properties with Get and Set? In other words, from within my class I want full access and from my form I only want read access. Right now I declare my variable as either Private or Public to control Public read/write access. I tried googling my question a bit but I'm not sure what the correct terms even ar
View 5 Replies
Mar 11, 2010
I have login form as start up form and i call Form1 after successful validation and in Form1, i have close button on click of Close i would like to reset username and password fields on loginform to null. If i add code in form1 below i get exception Dim fmLogin As New LogInForm
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
Make sure you do not have an infinite loop or infinite recursion
I get above on LoginForm below statement Dim fmMain As New Form1
View 1 Replies
Apr 13, 2010
This is my first major application using multiple classes. It is written in vb and I know about creating objects of the class and using that instance to call functions of the class. But how do I create an object with constructors to allow another program written in C# to access my classes and functions and accept things from the program.
View 3 Replies
Aug 15, 2011
I have a set of XML routines stored in a public class. There is a "sendMessage" function in this class. I'd like to be able to hit a button and have that function executed from my main class.
' Form = Main
Public Class Main
...
[Code].....
View 6 Replies
Mar 21, 2012
I am creating a simple XML web service and have run into something I can't quite explain.My web service class has the following structure :
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
[code]....
Invoking my method using the built in VS web service test harness works fine. I created another project, in another solution, to test consuming the web service. I added a web reference to my project and set it so I could reference my web service by using "localWS". Then in the page load event of my consuming class I tried to instantiate an object of my web service:
Dim srv As New localWS.MyWS
But there was no "MyWS" type found. There is however a localWS.MyWSSoapClient class. When I use it I can invoke my web methods. My question is, why can't I create a straight up version of MyWS class? In the tutorials I'v read, and in the book I have, example consuming classes for .NET XML web services can instantiate objects of the web service class they are consuming. As a further test I added a new web form to my web service project and from there I was able to instantiate a MyWS class.
View 1 Replies
Apr 13, 2011
I've encountered a problem which challenges my understanding of access modifiers in VB.Net. I have a class declared Friend. If I declare its properties Public, the application works. If I declare them Friend, the application fails.
Before this, I believed that, in a class declared Friend, it would make no functional difference whether I declared the members Public or Friend. I thought class access declarations applied their restrictions to all nested entities, so nested properties declared Public were effectively restricted as if they had been declared Friend. Obviously, I was wrong. Can anyone explain how access modifiers really work, or point me to the relevant documentation?
Here is a more detailed description of the situation: I have a Friend class called StripTask with properties called StripDate, HistorianDate, and TaskText. I have a collection of StripTasks (called _StripTasks) which is used as the data source for a Syncfusion GridDataBoundGrid. The way the binding works, I need to pass the name of a StripTask property to each of the grid columns so each column knows what data to display. It ends up looking something like this:_DataBoundGrid.GridBoundColumns(1).MappingName = "StripDate". When the mapped properties are declared Public, it works. When the mapped properties are declared Friend, the grid is populated with the correct number of rows, but every cell is empty.
As a follow-up question, is it a good idea to avoid things, such as this Syncfusion binding method, which require me to pass property names as strings? It just feels as if I'm inviting trouble.
View 1 Replies
Mar 4, 2012
I want to do this: [URL] but in VB. I believe that is for C# I have 2 classes.
[Code]....
I know I've been asking too many questions lately and I do apologise for that. I am trying to learn the basics
View 12 Replies
Oct 14, 2011
I have two classes[code]...
How can I modify class1 in a sub in class2?
View 2 Replies
Aug 27, 2011
Private _Order As Order() Public Property Order() As Order() Get Return _Order End Get Set(ByVal value As Order()) _Order = value End Set End Property
I need to get property name 'color' inside the 'order()' array, i am trying ' Order.color ' but its not getting,
View 4 Replies
Dec 1, 2011
how to access the variable from another [Code] I need to call the variable invoiceno in the class xmlserializer using ord1 and assign the value which the user enters during the runtime.
View 6 Replies
Dec 18, 2011
Example ^. I must be forgetting something or being really dumb.
View 3 Replies
Jun 30, 2011
I have two classes in two files in a class library project, they are:
Public Class Logins
Public CurrentUser As Login
Public Function Authenticate(ByVal id As String, ByVal pw As String)
[Code].....
View 1 Replies