-
May 27th, 2014, 07:53 PM
#1
Thread Starter
Junior Member
How to display the results in a pop up separate form?
My professor requires me to display the results in a different pop up form.
I have search, but dont know the keywords, any advice would be appreciated.
Last edited by johnnxiv; May 27th, 2014 at 10:58 PM.
-
May 27th, 2014, 08:54 PM
#2
Re: How to display the results in a separate form?
I'm not quite sure what sort of magic solution you expect to find. You create a form, you pass it the required data, you display it. Have you worked with more than one form before? Do you know how to display a form?
-
May 27th, 2014, 10:58 PM
#3
Thread Starter
Junior Member
Re: How to display the results in a separate form?
I think you miss my question, I know how to display the results in the listbox on the same form.
I don't know how to display the results in a separate form, that is my question
-
May 27th, 2014, 11:12 PM
#4
Re: How to display the results in a pop up separate form?
Um, no I did not miss your question. Why do you think I asked:
Have you worked with more than one form before?
Displaying the data in a separate form is exactly the same as displaying it in the same form. A form is a form. Once you have created the new form you pass the data from the first form to the second, populate the controls just as you would in the same form and then display the second form. So, what part are you having trouble with? I ask a second time, do you know how to display a form, i.e. a separate for to the one that you already have open?
-
May 28th, 2014, 12:24 AM
#5
Member
Re: How to display the results in a separate form?
Originally Posted by johnnxiv
I think you miss my question, I know how to display the results in the listbox on the same form.
I don't know how to display the results in a separate form, that is my question
u said u can display results in listbox on the same form so the problem is u cant do it on another form??
example i have 2 forms, name form1 and form2
so
fom1.listbox to display result at form1
form2.listbox to display result at form2
i dont know if these helps u..
-
May 28th, 2014, 08:47 PM
#6
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
Sorry for my stupidity, I tried and still didn't work out.
My first form is HW3.Vb, my output form is Output.vb
My calculation codes are
lstTotals.Items.Add(String.Format(fmtStr, "", "", "Value at", "Amount Deprec", "Total Depreciation"))
lstTotals.Items.Add(String.Format(fmtStr, "", "Year", "Beg of Yr", "During Year", "to End of Year"))
For i As Integer = 1 To YearDepriciate
amountDepr = DepreciatePerYear
If i = YearDepriciate Then
amountDepr = Cost
End If
TotalDepreciate += amountDepr
lstTotals.Items.Add(String.Format(fmtStr, "", YearPurchased, Cost.ToString("C"), amountDepr.ToString("C"), TotalDepreciate.ToString("C")))
Cost -= amountDepr
YearPurchased += 1
Next
Can any1 give me an example code?
-
May 28th, 2014, 09:03 PM
#7
Member
Re: How to display the results in a pop up separate form?
Originally Posted by johnnxiv
Sorry for my stupidity, I tried and still didn't work out.
My first form is HW3.Vb, my output form is Output.vb
My calculation codes are
lstTotals.Items.Add(String.Format(fmtStr, "", "", "Value at", "Amount Deprec", "Total Depreciation"))
lstTotals.Items.Add(String.Format(fmtStr, "", "Year", "Beg of Yr", "During Year", "to End of Year"))
For i As Integer = 1 To YearDepriciate
amountDepr = DepreciatePerYear
If i = YearDepriciate Then
amountDepr = Cost
End If
TotalDepreciate += amountDepr
lstTotals.Items.Add(String.Format(fmtStr, "", YearPurchased, Cost.ToString("C"), amountDepr.ToString("C"), TotalDepreciate.ToString("C")))
Cost -= amountDepr
YearPurchased += 1
Next
Can any1 give me an example code?
what do u want is displaying ur result at outform right? base on ur code above it has calculations but where did you pass the result value of that? in a textbox? listbox? label?
JMC]Displaying the data in a separate form is exactly the same as displaying it in the same form said by JMC
jmc is right it's so simple exactly the same as displaying it in the same form
if u will able to display result a HW3 form then it's the same as displaying it to other form by adding ur form OUTPUT,
example: HW3 form then
ur calculation code then pass to textbox1.text
the if you want to display it to OUTPUT form then
OUTPUT.mytextbox.text = HW3.textbox1.text
Last edited by robie; May 28th, 2014 at 09:08 PM.
Reason: edit
-
May 28th, 2014, 09:06 PM
#8
Re: How to display the results in a pop up separate form?
You aren't referring to that Output form anywhere in that code so I'm not sure how you expect anything to be output. I've asked you the same question twice now and you have refused to answer it. If you're not prepared to answer my questions then why would I write your code for you?
-
May 28th, 2014, 10:59 PM
#9
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
I have never work with more than one form before. Im a newbie at Vb.
Im trying to direct the codes to display in a Listbox on the Output form.
-
May 29th, 2014, 12:01 AM
#10
Member
Re: How to display the results in a pop up separate form?
Originally Posted by johnnxiv
I have never work with more than one form before. Im a newbie at Vb.
Im trying to direct the codes to display in a Listbox on the Output form.
so u mean "listbox" is the one getting the result right?
get some logic to these code:
Form2.Label1.Text = Form1.TextBox1.Text
it pass the value of textbox1 to label1.text.
-
May 30th, 2014, 01:03 AM
#11
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
I finally figured it out by online websites, Thanks but when ur explanation is too complicated?
Last edited by johnnxiv; May 30th, 2014 at 01:39 AM.
-
May 30th, 2014, 11:22 AM
#12
Member
Re: How to display the results in a pop up separate form?
good for you to resolve your problem..
i dont see anything complicated in my explanation even a beginner in vb can understand that -_-
Last edited by robie; May 30th, 2014 at 11:22 AM.
Reason: edit
-
May 30th, 2014, 02:18 PM
#13
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
Sorry I didnt see this in
Private Sub btnbtnDouble_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbtnDouble.Click
Dim frmHW3 As New frmOutput
frmOutput.Show()
or a similar example to that,
-
May 31st, 2014, 05:05 PM
#14
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
I'm trying to format my outputs to be nice and neat like this
http://www.vbforums.com/attachment.p...1&d=1401238326
but my outputs are ugly, what is wrong with my codes?
Dim fmtStr As String = "{0,2} {1, -10} {2, 10:N2} {3, 22:N2} {4, 25:N2}"
frmOutput.lstOutput.Items.Add(String.Format(fmtStr, "", intYearPurchased, dblCost.ToString("C"), dblAmountDepr.ToString("C"), dblTotalDepreciate.ToString("C")))
-
May 31st, 2014, 05:29 PM
#15
Member
Re: How to display the results in a pop up separate form?
question: your using multiline textbox or richtextbox in your output form?
Last edited by robie; May 31st, 2014 at 06:15 PM.
Reason: edit
-
May 31st, 2014, 07:29 PM
#16
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
Originally Posted by robie
question: your using multiline textbox or richtextbox in your output form?
Im using list box, you can see lstOutput.Items.Add
-
May 31st, 2014, 09:31 PM
#17
Member
Re: How to display the results in a pop up separate form?
ok then try these,
Code:
listbox.Items.Add("sample column1" & ControlChars.Tab & "sample column2" _
& ControlChars.Tab & "sample column3" & ControlChars.Tab & _
"sample column4" & ControlChars.Tab & "sample column5")
it set the column header of lisbox w/ 5 spaces each(tab)..
try the code if these align the items on your listbox
-
Jun 1st, 2014, 03:24 PM
#18
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
Thank for your help, but it didn't work because I followed a code I found online
Its all about the number "{0,2} {1, -10} {2, 10:N2} {3, 22:N2} {4, 25:N2}", I just dont understand them thats why
Dim fmtStr As String = "{0,2} {1, -10} {2, 10:N2} {3, 22:N2} {4, 25:N2}"
frmOutput.lstOutput.Items.Add(String.Format(fmtStr, "", intYearPurchased, dblCost.ToString("C"), dblAmountDepr.ToString("C"), dblTotalDepreciate.ToString("C")))
-
Jun 1st, 2014, 11:21 PM
#19
Member
Re: How to display the results in a pop up separate form?
try to make a new listbox and paste the code i post and you can see the output, its just a sample code to align each text..
Dim fmtStr As String = "{0,2} {1, -10} {2, 10:N2} {3, 22:N2} {4, 25:N2}"
me neither cant understand what these for, maybe someone would know
-
Jun 2nd, 2014, 06:09 PM
#20
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
-
Jun 2nd, 2014, 07:05 PM
#21
Member
Re: How to display the results in a pop up separate form?
im afraid the question you are referring for is outside of the topic..
basically you have some mistakes in your calculation method..
well your output form is nice and align now.. that's good
-
Jun 2nd, 2014, 08:58 PM
#22
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
sadly the output is still not nice and align, the double decline out put look ugly like above.
U have any idea why my variable keep adding up?
-
Jun 2nd, 2014, 09:51 PM
#23
Member
Re: How to display the results in a pop up separate form?
base on your picture, all i can see that add is the last column which is the Total depreciation to end of year? is that what u talking about?
in that case try to clear the value of that field, your restart button try make commands into it that clear or reset all your declare variable to 0 so that every time you restart it wont add the previous calculation.
if your having a hardtime in aligning the best way is to use listview or datagridview not listbox
-
Jun 2nd, 2014, 10:52 PM
#24
Thread Starter
Junior Member
Re: How to display the results in a pop up separate form?
What is the trick to force focus to only 1 window at a time? Let say my Results window poped up, how can I block user from using the bottom window? This is another way to prevent the user from multiclick the calculate buttom
Last edited by johnnxiv; Jun 2nd, 2014 at 11:37 PM.
-
Jun 3rd, 2014, 03:26 AM
#25
Member
Re: How to display the results in a pop up separate form?
what do u mean by bottom window? have a print screen so that it would easy to understand..
you u only want one form at a time you should hide the form you want and show the form you only want. that's basic
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|