Problem testing a simple program

mak2gd

Member
Joined
Jul 9, 2005
Messages
15
Location
Hartford, USA
Programming Experience
5-10
Hi,
I have a one form one module one function program that wont run when I try to debug it. When I click the run button I get a black screen that reads "press any key to continue..." and it disappears very quickly. I think the main form comes up and stops very quickly before doing any thing on it.

Please help.
Thanks in advance
Mo
 
Sorry kulrom,
The console concept is new to me. I placed the line in before End Sub in Form Load and still not working.

Can you please talk a little more about consoles?

Thanks a lot.
 
you know my english is not so good but, however let me str8 some things ... hmmm again maybe it's not good idea ... i think it would be better if i put some code below ... take a look at this

VB.NET:
Module[/color][/size][size=2] Module1
 
[/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Main()
 
Console.WriteLine("Hello !!!")
 
Console.WriteLine("")
 
Console.WriteLine("Press Enter to close the current window ... ")
 
Console.ReadLine() 'without this line console would just appear and close immidiatelly
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub
 
End[/color][/size][size=2][color=#0000ff]Module

Cheers ;)
 
Basically what I am doing is trying to recode a program that I used to have in VB6 to experiment with VB .Net. The program is an on screen calculator. An image of the form is attached. Each number button is going to send a value to the text box. When the user is ready, he/she is going to select a sign, send the next value to the text box. When finished, the user is going to click equal to see the results.


This is the module.

Module Module1

Sub Main()

Console.ReadLine()

End Sub

Public Function Operate(ByVal op As String, ByVal a As Double, ByVal b As Double) As Double

Select Case op

Case "+"

Return a + b

Case "-"

Return a - b

Case "*"

Return a * b

Case "/"

Return a / b

End Select

End Function



End
Module

 

Attachments

  • FormCalc.jpg
    FormCalc.jpg
    21 KB · Views: 42
mak2gd: It seems that you have created a 'Console Application' instead of a 'Windows Application'. A Console app is an old-timey app that utilizes DOS prompts. Why anyone would still use them is beyond me (actually the only reason would be to use as some automation tool from some other scripting tool).
When you create the new project, you should select 'Windows Application' which will give you the form designer in which you can place the buttons as shown in your screen shot.
 
Back
Top