Hi
I must be missing something very straightforward.
I load data in Form1 and show 'Name', 'Abreviation', 'Value1', 'Value2' etc
In Form 2 i have to show by a Combo Box into a list box the 'Name' and calculation of 'Value1 and 'Value2.
However when i go into Form 2 i just get the info that i asked to look at on Form 1.
I must be brain dead or something.
Help Please
8 2063 SammyB 807
Recognized Expert Contributor
Hi
I must be missing something very straightforward.
I load data in Form1 and show 'Name', 'Abreviation', 'Value1', 'Value2' etc
In Form 2 i have to show by a Combo Box into a list box the 'Name' and calculation of 'Value1 and 'Value2.
However when i go into Form 2 i just get the info that i asked to look at on Form 1.
I must be brain dead or something.
Help Please
No, you're not brain dead: it's hard the first time and difficult the second time. :) You just need to do two things: - Pass a Form1 reference to Form2 by overloading Form2's constructor.
- In the Forms Designer for Form1, set the Modifiers to Protected or Public.
Hi
[quote]
No, you're not brain dead: it's hard the first time and difficult the second time. You just need to do two things:
Pass a Form1 reference to Form2 by overloading Form2's constructor.
In the Forms Designer for Form1, set the Modifiers to Protected or Public
[quote]
I have gone into Forms Designer for Form1 and their is no Modifier to set.
And what do you mean by overloading Form2's constructor.
Also will this still enable me in Form 2 for each 'Name' Selected from ComboBox i will be able to show each one in a List Box
Thanks
:wave:
:wave:
:afrog:
I'm all goggle eyed
Trying to sort problem my self but just getting lost
HELP PLEASE
Thanks
SammyB 807
Recognized Expert Contributor
:wave:
:wave:
:afrog:
I'm all goggle eyed
Trying to sort problem my self but just getting lost
HELP PLEASE
Thanks
Sorry, I missed your eariler post, my spam filter removes post notifications. Your thread question title has 2005 in it and I assumed that you are using VB.NET 2005. But from your replies, it seems that you are not. What VB are you using? VBA, VB6, or VB.NET
Hi
Am using 'Visual Studio 2005' v.8 with the MS .Net Framework v.2
Hope this helps
Thanks
SammyB 807
Recognized Expert Contributor
Hi
Am using 'Visual Studio 2005' v.8 with the MS .Net Framework v.2
Hope this helps
Thanks
OK. let's start again and just create a simple two form example in VB. Then, you can use the principles for your forms. - Open VB.NET, create a new Win App and add another form
- Put a textbox and a button on form1
- Select the textbox and in the properties window change the Modifiers property from Friend to Public
- Open the form designer for form2 and double-click on the form to create a load event
- Add a property to Form2 that will hold the Form1 object. Now form2 code should look like:
- Public Class Form2
-
Public FrmParent As Form1
-
-
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
MsgBox(FrmParent.TextBox1.Text)
-
End Sub
-
End Class
Finally, switch back to form1 and double click on the button. Add the following code so that form2 code looks like - Public Class Form1
-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim frm As New Form2
-
frm.FrmParent = Me
-
frm.Show()
-
End Sub
-
End Class
Running this, you can see how multiple forms can work together. In form1, the form1 object is called "me", and the form2 object is called frm, In form2, the form1 object is called FrmParent and the form2 object is called "me". Either form can access anthing in the other form that has been declared public: controls, properties, or even methods (Sub). So, now you need to decide how to communicate and how events on one form should affect the other form. --Sam
Hi
This is part of the code in Form2 that requires the info from Form1 - Private Sub cmbSpecies_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbSpecies.SelectedIndexChanged
-
Dim Perc As Decimal
-
-
'cmbSpecies.Items.Add(Form1.txbSpecies.Text)
-
Select Case CStr(cmbSpecies.SelectedItem)
-
Case "Brown argus"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Glanville fritillary"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Purple hairstreak"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Silver studded blue"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Chalkhill blue"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Large blue"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Common blue"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Grizzled skipper"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
Case "Silver washed fritillary"
-
If CDbl(Form1.txb2000.Text) <= 0 Then
-
MsgBox("This is New Data for " & Form1.txbSpecies.Text)
-
End If
-
Perc = CDec(CInt(CStr(CDbl(Form1.txb2005.Text) - CDbl(Form1.txb2000.Text))) / (CInt(CStr(CDbl(Form1.txb2000.Text))))) * 100
-
-
End Select
-
-
'Cannot seem to make this Format work
-
Format(Perc, "0.00%")
-
'This does not seem to be working. Trying to make sure that
-
'a Species is selected
-
If cmbSpecies.SelectedIndex <> -1 Then
-
-
lbxButter.Items.Add((cmbSpecies.Text) & " " & CDbl((CInt(FormatCurrency(Perc)))))
-
End If
-
-
End Sub
This is part of the code in Form1 -
Private Sub btnForm2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForm2.Click
-
-
-
-
Dim frmForm2 As New Form2
-
-
frmForm2.Show()
-
-
-
End Sub
-
I have now made the Text boxes in Form1 Public (in Modifier) and the btnForm in Form 1 also Public. ann.jenkins1606@btinternet.com
I still have the problem that when i select from the Combo box in Form2 i only obtain info that is showing on Form1, i could have both forms open and display from Form1 and select on Form2.
I hope i have not sent too much info.
My brain is almost dead, but i am determined
Thanks
Hi
Sorry to be a nusiance any help out there
Thanks
Sign in to post your reply or Sign up for a free account.
Similar topics
by: perplexed |
last post by:
Is there a way to combine the values of multiple form items such as two
textboxes and one radio button for insertion into one MYSQL database
field?
|
by: Matt |
last post by:
I have an interactive web page that I need to prevent refreshes on.
The problem is that I want to ALLOW resubmissions, but only via the
submit button. My web page has two forms on it, one form for...
|
by: Roshawn Dawson |
last post by:
Hi All,
When you open a .aspx page in VS.NET, it has the form tags
(<form>....</form>) already present. I am trying to create a web user
control that contains textboxes, buttons, and other form...
|
by: Johnny E. Liner |
last post by:
Hello,
I am working on a WebApp and I am running into some trouble with
multiple form tags. I have a Master page that contains three
controls: MasterTop, MasterBottom, and Content.
The...
|
by: faww |
last post by:
i have been working with visual basic.net for about a year, ive actually managed to pass my teacher's knowledge of it, and he cant help me anymore with it. ive been designing a role playing game, and...
|
by: rmsterling |
last post by:
All,
Subject : SQL Server 2005 SSIS Script Help - XML Secure Pull in to DB table
I was wondering if any of you could help me with something.....
I want to design a SSIS script that will pull...
|
by: Fary4u |
last post by:
Hi Guys
i'm trying to upload a file, i've tried 3 different methods but still not work out i don't know how to over come this problem
hidden file value, multiple form or popup uploading.
1-...
|
by: Mary arilene |
last post by:
Hi,
I currenlt building a form and would like some help validating multiple checkboxes and receiving values.
I'm using two two pages there asp pages.
HTML code(with the body tag)
...
|
by: hidhayathullah |
last post by:
I use request.Form(fieldname) it is work single form
i used multiple form then not work this coding-request.Form(fieldname)
please help me
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |