Variable Value Exchanging Over Seperate Forms?
Aug 4, 2011
How do i go about making variables on a second form have the same value as in the first form while still being able to make the variable on the first any given word or phrase and it appear the same on the second form?
View 2 Replies
ADVERTISEMENT
Jul 9, 2011
i'm working on a project and i need to know how to exchange data between two forms,so like there's two forms one loginform and other the main form and if the login is correct,a boolean will be set to "true" .the problem is you have to dim the boolean twice, each in the two forms,so there's no way to exchange the data.i tried it so that if the login is successful,a textfile is created and then the main form detects the text file automatically,
Public Class Form1
Dim sdata As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
[Code].....
View 5 Replies
Sep 5, 2010
Using Visual Basic 2008 Express. I need to pass a variable to another form. Or else make the variable visible to both forms.
View 4 Replies
Feb 17, 2011
I have a VBA form in Microstation I am using to try and help automate a task. The only problem I am having is I am reading a textbox (Filebox.Text) and setting it as the variable (FN). It works, because I used Msg.Box (FN) to test it. However, in two of the lines of code, I am trying to use (FN) to pass the typed in filename to the command to run in Microstation. Unfortunently, it gets passed on as (FN).dgn instead of the actual filenale typed into the textbox. Is there a way I can make the variable actually seen as a variable? Code on Pastebin: url....Also, not sure if this is the right section, 100% new to VBA, coming from a world Bashed together.
View 3 Replies
Apr 22, 2010
This is my first Windows app to create since VB6. I've been in the world of ASP and ASP.NET for many years. However, now I have been asked to create a simple app that needs to be windows based.
[Code]...
View 4 Replies
Mar 10, 2009
Hi.
Im using this little function to search for text within some downloaded HTML source:
Public Function GetStringBetween(ByVal InputText As String, _
ByVal starttext As String, _
ByVal endtext As String)
Dim lnTextStart As Long
Dim lnTextEnd As Long
lnTextStart = InStr(StartPosition, InputText, starttext, vbTextCompare) + Len(starttext)
lnTextEnd = InStr(lnTextStart, InputText, endtext, vbTextCompare)
If lnTextStart >= (StartPosition + Len(starttext)) And lnTextEnd > lnTextStart Then
GetStringBetween = Mid$(InputText, lnTextStart, lnTextEnd - lnTextStart)
Else
GetStringBetween = "ERROR"
End If
End Function
It works great, but i need to be able to search for something that spans over 2 lines. E.g.
Sam works in a shop from the hours
of 09:00 to 15:00
I want to search for the words "hours of" - but because they are on seperate lines, it cannot find it.
I have tried "hours" & Environment.NewLine & "of" - and other variants of envirmonment.newline (knowing they all return the same value, but, hey, you gotta try) but to no avail. Surely there must be some sort of syntax to ge around this?
Any ideas?
View 5 Replies
Jun 11, 2011
Greetings,
My app saves a bunch of stuff to an XML file. This is my line of code-
Using writer As XmlWriter = XmlWriter.Create("C:vdx2kMWSREEXTReportsInboxTK" & frmCitation.txtCiteNumber.Text & "Traff.xml", settings)
So that saves it at that specific location.
I need to duplicate the XML and have it also save in another location. I've been at this for days, Googling, searching, trying different things and now I need to turn here for help.
Any ideas?
View 2 Replies
Mar 6, 2010
i wish to run a program with 2 forms form 1 will have 2 radio buttons and a textbox and form 2 will have 2 textboxs i wish to use the radio buttons to select wich information is bieing displayed from either form2 textbox1 or textbox2 using the radio buttons on form1 then display the information in textbox1 of form1.
View 4 Replies
Jun 16, 2010
I'm trying to open a connection and create an SQL statement with two different tables in different Access DBs. Is this possible? I'd like to join the tables in a query.
Is there a great advantage in splitting somewhat large Access databases? Or is it best to just create a large access database with many tables?
View 3 Replies
Feb 19, 2010
Basically I try to get a DataGridView and a BindingSource working inside a class. I define them by:
Dim TempDGV3 As DataGridView = New DataGridView
Dim TestBinding As BindingSource = New BindingSource
When I manually add columns to the DataGridView, it works perfectly, but when I set it's DataSource to a bindingsource from a base class, it doesn't load data and keeps throwing 'object does not exist' errors. The bindingsource mentioned here did, however, work on other DataGridViews that are defined in the base class (and implemented in the form to which the base class belongs)
Same for the BindingSource(not the above mentioned, but the one I try to create inside the class in the beginning of this post). I try to use it in the following way:
TestBinding.DataSource = TempDGV3
TestBinding.Filter = filterString()
SourceDataGridView.DataSource = TestBinding
But the BindingSource keeps returning 'Nothing' for it's datasource and basically doesn't work. However, the SourceDataGridView mentioned here gets filled with 63 columns with "AllowUserToAddRows" and other properties when the columns names are asked.
So my question is: how do I get the BindingSource and the DataGridView to work in this class? I'm getting the feeling I'm missing out on something very obviously here. If that's not the case, I can report back with more code?
View 8 Replies
Sep 12, 2009
This is a very basic newbie question, but I still haven't worked it out yet. I have a fair amount of code that I want carried out inside my Form1_Mousemove event, but I also want the exact same code inside the Form1_MoveClick event. I assume the best solution is to take all of the code and put it inside a seperate procedure and call it from both events? Or is it possible to call one of the events manually so inside my Mouseclick event, could I force a call to the Mousemove event?
View 20 Replies
Feb 27, 2010
I have a program where a user puts a string into a textbox, and then character one goes into Textbox1, char2 goes into TB2, char3 goes into TB3, etc.I have a For loop that gets all of my textboxes that are used for this, and I have my for loop that is supposed to go through my string character by character.[code]
View 7 Replies
Sep 30, 2009
I have a string full of html & which reads
Dim strHml as string = "<html><head><title></title></head><body><div class="normal">Dog</div>
<div class="normal">Cat</div><div class="normal">Elephant</div><div class="normal">Giraffe</div><div class="normal"><div><p>Random Div</p></div>Lion</div><div>Wolf</div>
<div>Tiger</div></body></html>"
I want to somehow be able to pull all the div tags and their content and put each one into an array have looked at split function and regular expressions but no clear and easy solution has presented itself as yet.I have amended this slightly to incorporate nested div tags, but those tags I still need returning in the format :-
<div class="normal"><div><p>Random Div</p></div>Lion</div>
View 1 Replies
Jun 5, 2010
I'm relatively new to the vb.net framework and object oriented programming. After perusing the threads for a few hours I can't quite find an answer so I'm posting this thread. I'm not necessarily looking for code examples. I just want to know if it's possible and where to look next. Basically I'm trying to build a starter application that will help me learn programming. One of the main things I want to do is to be able to dynamically (at run time) create a set of information (data) that can be manipulated via a set of static (and/or dynamic) functions/calculations. The reason I need it to be dynamic is because even though this program is really just for my own fun and perusal on my own machine (and I want it to be able to run without any outside connections (i.e. databases or servers) the data itself is going to be location (i.e.State of residence or even city) specific. Essentially most of the data will be numerical and can be of the integer type. But I'd like to be able to adjust and create new data sets if desired. From everything I've read and researched I haven't found a way to do this (at least now without an excessive amount of coding that is above my expertise). So I want to know if there is a way to do this that is relatively simple.
View 2 Replies
Jul 1, 2010
I did this before, but i totally forgot how to do it.I have an array, the array contains strings with 2 seperators.like so:
name1 / name2 / name3
Basicly i want name1, name2, and name3 in 3 seperate lists, or arraylists. But, i don't know how to do it.Each line is being read from a file.
View 15 Replies
Oct 23, 2009
I have two windows forms in my application, and I want to have variables that work between them. How would I do this?
View 2 Replies
Oct 28, 2009
I want to calculate the score on one form and display the score on another form
View 7 Replies
Sep 11, 2009
i have a dialogbox (dialog1) i will assign the input from textbox a variable to the from1 but i cant do that.the variable in form1 is Dim get_from_dbox As Long i try to assign to it from dialog1 like below it fails form1.get_from_dbox = Textbox1.Text but i can assign to textbox??like that which works well
form1.RichTextBox1.Text=Textbox1.Text I am new programing i know i am wrong .don't know where?
View 1 Replies
Sep 20, 2010
I am struggling to find out how to use a msg box to display the value of a variable.
I've tried a number of permutations, and searched for hours to find a tip.
My code is currently:
Private Sub btnShowTotalCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowTotalCost.Click
If (radCorpTravel.Checked) Then
[Code].....
View 10 Replies
Jun 15, 2010
i have 2 forms -> form 1 and form 2
in form 1 -> 1 button
in form 2 -> 1 textbox and 1 button
when I click button in form 1, it will show the form 2..how can i pass the variable (data from textbox in form 2) into a variable in form 1 after clicking the button in form 2 ?
View 8 Replies
Jul 31, 2009
When I declare a variable as public, shouldn't it be available in another form? I am trying to write a windows mobile prg with 12 static mileage points, form1 has the 12 buttons for start point, but when I call form2 with the destination points, my start variable value is not carried over. I intend to then assign a mileage based on the two points and write to file on mobile device. We support 12 schools, and I want my employees to track mileage easily.
Public Class main
Public start As String = "start"
Public dest As String = "dest"
Public miles As Decimal = 0
[Code] .....
View 4 Replies
Apr 20, 2009
I want to create a variable to be used by multiple forms, so I created a module that looks like this:[code]I expected the title of that specific form to be "(Name)'s Settings"But instead, it just says "'s Settings," as if the variable had never been assigned a value.
View 4 Replies
Feb 7, 2010
Variable readable from all forms?
View 14 Replies
Jun 26, 2010
In my previous knowledge of programming, i used to use global.variable = true how could i achieve this so the variable could be used across all forms?
View 1 Replies
Jun 8, 2011
I have one form, which the user enters upto 5 websites then clicks go - I have on the second form, the one with the webbrowser. A timer which checks if the web browser is busy then either a green light or black image will be shown along side the assocaited input box on the first form.I am finding it impossible to feed variables into the clock through ByVal, like I would a subroutine or function.
Private Sub ActiveMe_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ActiveMe.Tick
If ((WebBrowser1.IsBusy)) Then
Hey.BackColor = Color.Black[code]....
'Error message says Hey is not declared, as i can't pass it through to timer
The variable Hey is determined by the first form - Which picturebox.I have an if statement which simply says if inputbox one has url enter then Hey = Picturebox1, If input box2 has url entered then Hey= Picturebox2 etc.What I want is the timer to check the page has completed loading or is still loading or refresing and the appropriate green or black to be shown aside url input box on first form.I considered using a sub or procedure to act as a clock (a large for loop with another for loop within it, acting as a delay). But found this slowed down theapp to the point of crashing it.
View 1 Replies
Sep 3, 2010
I have the following form: Imports System.Data.SqlClient Public Class Form1 Dim ReturnValue As Object = Nothing
[Code]...
View 12 Replies
Jul 27, 2009
I have a label in my Form which on loading, displays the contents of a text file. The contents of the text file may change and if so, the number of lines also will. I would like the Form to automatically resize itself based on the number of lines in the file. If there are more lines that the size of the label can take, I would like it to either resize or show scroll bars.
View 2 Replies
Dec 3, 2009
My app has a group of forms that do a specific work in different ways. I want to create a new variable of a form when I want with its name. So, I want a Function in this form :
Public Function GetNew (byref f as form ) as form
That give a form name and return a variable of that type. In other words, it must work as "dim f1 as new formx".
View 4 Replies
Jul 17, 2010
I want to pass variables from one form to an other. The variables i I need in the second form( called" Hulsview") are :" hulsbreedte" and" hulslengte". To check if the varibles are passed I added a textbox in the second form,called" hulsview" to check the variable" hulsbreedte". The value selected in the combobox on on form1" hulsbreedte = HulsBreedte1.SelectedValue" returns always 0 in the textbox on de second form.
Here is the code form1:
Imports System.Drawing.Drawing2D
Public Class Form1
Inherits System.Windows.Forms.Form
Public hlb As Point 'not used
[Code] .....
I am using vb express 2010.
View 1 Replies
Jun 25, 2011
i have a class called car and within that class i have a few vairables
Public Class car
Public Property Name As String
Public Property ID As Byte
[Code].....
View 5 Replies