Keeping Track Of Values In Different Forms?

Feb 10, 2011

I am trying to create a quiz application in Visual Basic 2008. I need to be able to store a score value when the player gets a correct answer. When the value is stored a new question set appears. Once the score is calculated I want to be able to show this is in a new form so the value needs to be passed from one form to the other. I'm not entirely sure how to do this but I believe it will incorporate a module.

View 9 Replies


ADVERTISEMENT

C# - Keeping Track Of Values With Dynamically Created Controls

Jun 14, 2011

I have a WPF application that allows users to create questions of all different types which depending on the type will use a textbox,combobox,checkboxes, or radio buttons to allow the user to answer the question after they build some sort of questionnaire. My question is what is the best way to keep track of the answers across all the different controls after the controls are created and the questionnaire is created on the fly. Right now, i'm looping through all the containers and getting the values based on the controlType.

View 1 Replies

Keeping Track Of Choices?

May 24, 2011

I have two combo boxes, and four buttons. When the user clicks "Add" on the first combo box, it adds a new item to the combo box with "New" and then lets the user rename that item to something else. That "new" item has to have an array of "answers" that go along with that item in the list. What I'm having trouble figuring out is assigning "answers" to the second combobox for each item in the first combobox and changing the second combobox when selecting an item in the first combobox.

EXAMPLE:

Item 1 - Combobox1
- Item 1 - Combobox2
- Item 2 - Combobox2

[code]....

View 5 Replies

Keeping Track Of The Points Of .DrawEllipse?

Dec 16, 2009

I want to know if the user clicked on the Ellipse (just the line of nonfilled ellipse)? I don't care if the click inside of it,JUST the LINE. I made a copy of the orgianal rectangle info before drawing it. And then I tried .contains on the mouse click? and that allows me to click everywhere

View 10 Replies

VS 2008 Keeping Track Of Ellipses?

Mar 8, 2010

Suppose i want to draw semi-random ellipses on my form.Is there any way i can check if they get clicked at a later stage?Is there any way of storing the location of individual ellipses and then comparing the mouse-click to my list of locations to see if one was clicked?

I can imagine how it could be done with squares or rectangles, but i dont know how to approach it with ellipses.

Im sure this has been asked before, but i've spent a good while searching around for something i can use and came up emptyhanded.

View 5 Replies

Basic Calculation - Keeping Track Of Total Number Of Discounts

Sep 5, 2009

I am trying to keep track of the total number of discounts given (whole numbers) I keep getting .75 after the first discount, and it adds .75 for every trans action after that. I have tried to pick it apart but I just don't see it. You can follow by tracking the comments that relate to the summary. I know that is an Integer but the book has it declared as a decimal so I went with it.

Public Class BookSaleForm
'Declare module level variables
Private QuantitySumInteger, SaleCountInteger As Integer
Private DIscountSumDecimal, DiscountedPriceSumDecimal As Decimal
Const DISCOUNT_RATE_Decimal As Decimal = 0.15D
[Code] .....

View 2 Replies

Code - Add The Elements To The Stack With Keeping Track Of Adding And Deleting

Feb 15, 2012

I am trying (Push)add data into my stack (length of five) and (Pop)delete from the end of my stack.

I need to know how can:

- Add the elements to the stack with keeping track of adding and deleting from it (adding an element will increment until 5 and deleting would decrement until the stack is empty).

Private Sub Button1Push_Click(sender As System.Object, e As System.EventArgs) Handles Button1Push.Click
Dim Stack(4) As String

[CODE]....

View 4 Replies

VS 2010 Keeping Track Of 'Active' Tabpage With Multiple TabControls?

Aug 11, 2010

I am building a sort of 'lightweight' Visual Studio, and I'm trying to implement the feature where you can drag tabs to different 'tab groups', viewing multiple tabs side by side.

I got nearly everything working, I show a ContextMenuStrip when you rightclick the tab headers, with the option of creating a new (horizontal or vertical) Tab Group. When that happens, a new TabControl is added dynamically and the selected tab is moved there. You can drag the tabs around inside a TabControl and even from one to another.

The problem now is keeping track of the 'active' tab. Since I have multiple TabControls (not just two, there can be as many as you want theoretically), their SelectedTab properties are basically useless. How am I to determine which TabControl the user is currently working in? Obviously I will always have multiple selected tabs, but only one active tab, in which the user is currently typing, editing, whatever.I need to know the active tab for obvious reasons: many menu and toolbar items act on the active tab for example. A short explanation of my controls:I have one TabGroupContainer control, which inherits UserControl. I have a TabGroup control, which inherits TabControl.I have a Tab control, which inherits TabPage.

The TabGroupContainer holds a collection of TabGroups (to which I dynamically add/remove TabGroups when required). Now I want the TabGroupContainer control to have the ActiveTab property which returns the one and only active tab (out of possibly many selected tabs).The only logical way is to keep track of the tab that was selected last, for every TabGroup.

At the moment, I am doing this:

- In the TabGroup (TabControl) class, I shadow the SelectedTab property (and return a Tab instead of a TabPage). More importantly, in the property setter, I raise a SelectedTabChanged event:

vb.net
Public Shadows Property SelectedTab As Tab
Get
Return DirectCast(MyBase.SelectedTab, Tab)

[code]....

However, it still doesn't work. I soon figured out why: I am checking that the previously SelectedTab is not the same as the new value in the property setter of the (shadowed) SelectedTab property. I don't raise the event when they were the same, and in this case they were the same (as there is only one tab in the TabGroup!).So, I took that check out, and now it seems to work when I click in the text editor.

So one problem remains: the active tab is not changed when you click on the tab header (and not on the text editor). I am clueless as to how I should handle this... I am once again sure there is a simple fix, but I cannot see it. I can click the tab header, and I'm sure behind the hood it responds to this click, but it never raises it SelectedIndexChanged event because the index didn't change but was set to the same value it already had. I cannot override the SelectedIndex property (so I could skip this check and raise the event anyway even if the value didn't change), and the OnSelectedIndexChanged method is not called, so I cannot use that either...

View 6 Replies

Using A Hashtable To Keep Track Of Forms?

May 9, 2011

I was using the For Each frm as From In Application.OpenForms but it seemed a bit inefficient to loop thru every open form when I already knew what I was looking for. After some googling I found some information about hashtables so I used the following code. This code works as long as another form, say form3, isn't open with the same ID. What I am trying to figure out is, why is the hsh.contains only looking at the key instead of looking at the key/value pair?

Form1
Public hsh as New HashTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

[code].....

View 2 Replies

Track Bar Changing Transparentcy Of Forms?

Mar 24, 2011

On my program I would like a track bar to change the Opacity of certain forms. There is a checked list box so if the user checked the main form and some other forms, boxes and used the track bar to change the Opacity of those forms. If the user uses the track bar and goes right it will increase the Opacity and to the left decreases the Opacity. Then when the user is all done He/She will press the Apply button to apply the changes of the Main Form or Forms.

View 11 Replies

Capturing And Keeping RTB Font Values Via Font Dialog?

Jul 27, 2010

everything tests well but when I evoke the function the dialog values default to selections other than what the text was originally/last set to (e.g., color, font, size, etc. in the dialog/menu is not what is shown in my rich text box).how I can set the above values per the text being recalled in the RTB? That is, in the above scenario if I hit the cancel button I lose the original text formatting.

Public Class frmComment
Private Sub FontDialog1_Apply(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontDialog1.Apply
If Not RichTextBoxPrintCtrl1.SelectionFont Is Nothing Then

[code]....

View 4 Replies

Forms :: Retrieve Values From Objects Between Forms?

Feb 9, 2009

In VB.net how do you retrieve an value from a object in a different form.
eg:

' on frmMain

MsgBox ("Say ""Hello World"" Mr. " & frmOther.txtName.text)

View 7 Replies

Forms :: Passing Values Between Forms

Jul 23, 2009

My scenerio is a form with a button, when clicked opens a form dialog. The dialog allows the user to enter a text box. I want to read the value of the text box from the main form into a variable to be used with an SQL statement. The following code is used to create a new instance of the form dialog if one does not exist:-

[Code]...

View 2 Replies

Asp.net - Passing Values Between Web Forms?

May 1, 2011

Im trying to pass a value of a date control from form1 to form2.on form 1.aspx.vb:

Public ReadOnly Property Property1() As Date
Get
Return StartDate.SelectedDate[code].....

Tried to assign the property to a string, it did not work either.

View 2 Replies

Passing Values Between Forms

May 27, 2009

I think I'm getting hung up on syntax here. I've got 2 forms and am trying to pass a textbox value from the 1st form to the 2nd. The textbox value is an unique ID #, so it's an integer value in the database. The ID displays in the textbox just fine on the 1st form. When I try to access the value of this ID textbox in code in the 2nd form, I see that the value is empty, or equal to "". But I see a valid ID # on the 1st form. Here's the code that shows me that the textbox equals "".

[Code]...

View 2 Replies

Passing Values Between Forms In VB?

Jun 4, 2012

solid rundown of how this process works using custom events &EventArgs, Im really having trouble wrapping my head around it

View 14 Replies

Sync Values In Forms?

Feb 29, 2012

How do you guys take control of a listbox in a form from another form? I could have sworn I've done this before but can't remember how or find any of my programs that did this. In form load i populate a listbox with a routine. I wish to call that routine again to refresh it from another form.

View 3 Replies

Values Are Seen On Forms But Not On Database?

Nov 15, 2011

When we input values, and retrieve them in forms, we can see them. but when we look directly into our database, we can't see it.

Here is our codes to add values.

Private Sub Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add.Click
If ClassName.Text = "" Then

[Code].....

View 3 Replies

Calculating Two Values Of Textboxes From Different Forms?

Jan 9, 2012

i have a question on how to add two values of placeholder on different forms. in the forms i put a placeholder for "correct answer" and "wrong answer" so one of this placeholder will have a value of integer. how can i add a value on the first form to the other placeholder of the other form.

View 5 Replies

Events Transfering Values Between Forms?

Feb 6, 2009

I have a form set up that allows the user to do many things to manipulate items. One of the things they can do is replace an item with another. To do so, what I have them do is click the Replace button on the main form. This calls the show of a choose replacement form where there is a grid view containing the replacement options and a Replace and Cancel button. When the user selects a product from the grid, and clicks the replace button, I want the item's ID to be sent back to the main form to be used in the replacement sub.This is what I have:

Main form:

Form Load:

AddHandler replaceComponentForm.Replace, AddressOf Me.Replace
ReplaceButton.Click[code].....

The problem is the events don't seem to be reaching the main form. The replacement form closes, but Replace does not get called in the main form.

View 3 Replies

Forms - Checking If Values Have Changed

Jun 10, 2010

I'm basically putting some validation logic around an undo button on my form and i'd like to check whether any fields on the form have had their values changed so i can ask the question "abandon changes?". This seems like something pretty standard to me but I can not see how to check whether a value has had its contents changed (without recording a before value and comparing it to the after value which for large forms would be quite horrendous to code).

In the language i used to use we used to walk the object tree (so we dont have to specify each object individually like text box, combo box etc) and check any object that have value-changed = yes to indicate the validation was required.

View 1 Replies

Forms :: How To Retrieve Values From The Database

Jun 7, 2012

i am new to vb.net and dont have any idea about using datareader.i am right now doing a project on vb.net and am facing an issue.i have a form, where in i have to select the matching records from the database and show it in various textfields. as far as the query execution is concerned, i have successfully completed it, but i am facing an issue now. Suppose, i have an Id of a student, and he has registered for 3 courses, when i give the query something like select students.studentid,courseid,midtermmarks,finalterm marks from marks,students where students.studentid=course.studentid;it gives me multiple records.my doubt is, when i get multiple records, and which is true(in the case a student has registered for multiple courses), how can i traverse through the resultset and fetch the values in the respective textfields.

View 1 Replies

Forms :: Values From Mdi Parent To Mdi Child?

Dec 15, 2009

Is there any chance to pass values from mdi parent to mdi child.

View 1 Replies

Forms Retaining Values After Closing

Jan 4, 2011

Throughout our program, forms are opened like this[code]...

The problem is that when forms are closed, they seem to not really be closed, only hidden - if I add some text to a textbox and close/reopen the form, the text is still there, rather than the textbox being cleared like normal. This is presumably because the form always uses the same instance.

Is there any easy way to fix this other than going through the entire program and creating a new form instance for every ShowDialog() call (there are hundreds)?

View 4 Replies

How To Transfer Values Between Textboxes On Different Forms

Feb 5, 2010

I am currently building a mortgage application and currently have two forms, the way the system works so far is the user selects an option from a series of radio buttons whilst a score is kept based on the options chosen, this is then displayed in a text box to the user, on the second form there are more choices, and a textbox to display the final score, what I can't figure out is how to get the value from form one to the textbox on form two when the user clicks next on form1 to get to form 2.

View 3 Replies

Passing Values (integer) Between Forms?

May 1, 2012

My problem is that I have two forms, Form1 and Form2 ...on Form1 there is a TextBox called txtTotal (this contains the calculation of Ticket Prices, thus it's a numeric value) and on Form2 there is a TextBox called txtTotal2. All I want to do is get the same number that appears in txtTotal on Form1 to appear in txtTotal2 on Form2 .However whenever I try some of the help tips online such as using a declaring txtTotal as global or friend it dosn't work, and any other code iv tried attempts pass the textbox value as String which brings an error.

View 2 Replies

Store Variable Values Between Forms?

Jul 12, 2010

My application sends information from Form1 to Form2 by means of a global variable on Form1 whose value is read by Form2.

This variable is basically used to tell Form2 what it has to do because it's value will change depending on different conditions.

All form2 is meant to do is load data from a database into DataSets which will "ported" to Form1 (the main form) for consumption. I use a Form for this rather than a class because there's a lot of data that will be loaded each time it's visible and I wanted[code]...

View 6 Replies

Winforms - Passing Values Out Of Forms?

Sep 8, 2011

I have a very simple windows forms setup. Form1 has a progress bar and a button on it, when clicked the button opens Form2 which also has a button on it that launches Form3. On Form3 is a button which I want to use to raise an event back to Form1.To achieve this can I add an event handler on form1 that will listen for an event of the type raised in form3? Or do I have to pass references to form1 to form2 and then from form2 to form3?

View 1 Replies

Forms :: Add All Values Found In The Groupbox Textboxes?

Nov 26, 2009

I have a groupbox with a number of textboxes. I want to loop through all the textboxes, get their value( text) and add them all together and show it in a final totaltextbox outside the groupbox. This is what i have done but it does not work. The totaltextbox values do not change. Here is my code :

Private Sub AGroupBox_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles AGroupBox.VisibleChanged
Dim xxx As Integer

[Code].....

View 7 Replies

Forms :: Passing Values Into Controls Of Other Form?

Sep 30, 2011

I have to ask a stupid question:How to pass values from my form into the controls of other form?I made textbox and button in my form1 and Label into the form2 When I click the button, I want to pass the values of the my textbox in the form1 into the labels of my form2

I am a student and totally new to vb.net

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved