|
Hi Guys,
Every time I try to verify if the user wants to exit the app, the question box comes out twice. I do it like this:
Private Sub Register_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing<br />
Dim exitChoice As Windows.Forms.DialogResult<br />
exitChoice = MessageBox.Show("Are you sure you want to exit?", "Exiting?", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)<br />
If exitChoice = Windows.Forms.DialogResult.Yes Then<br />
Application.Exit()<br />
Else<br />
e.Cancel = True<br />
End If<br />
End Sub
It comes out twice even if yes is clicked the first time.
How do i make it come out only once?
He who goes for revenge must first dig two graves.
|
|
|
|
|
The form is closing anyway so remove the application.exit (assuming this is the final form)
Only do the cancel = true if they want to stay in.
Private Sub Register_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Dim exitChoice As Windows.Forms.DialogResult
exitChoice = MessageBox.Show("Are you sure you want to exit?", "Exiting?", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)
If exitChoice = Windows.Forms.DialogResult.No Then
e.Cancel
End If
End Sub
|
|
|
|
|
' you need to add the following code to fix it
' on the same file where your Register_FormClosing is, declare this
Private if_already_close As Integer
' inside your Register_FormClosing, add
' before Dim exitChoice
If if_already_close <> 1234 Then
if_already_close = 1234
' your MessageBox.Show(...) codes here
End If
' before the End Sub
TMALBONPH
|
|
|
|
|
Hi.
I want to draw an arrow (like a triangle or something like that) on an existing line to show a direction. The lines are in different directions.
an example of the picture can be found here
here
The coordinates are calculated on an circle.
Jan
|
|
|
|
|
You ahve to create a pen to draw line. Did you happen to see the StartCap and EndCap properties of the Pen class? There are your arrow heads. A little perusing of the MSDN documentation will give you all the details of the Pen.EndCap and Pen.StartCap properties.
|
|
|
|
|
I did already had a pen I already drowed some lines .
I know the the pen has some possibilitys. However. An arrow at the end or beginnings of the line do not help. I need it on about 25-40%. That location was not difficuld. The trouble was how to rotate my triangle/arrow into the write direction
However, someone else has given me an direction with sin and cos and atan. and that is what I neeeded. So know i'ts solved
|
|
|
|
|
Kindly let me know the difference between Visual Basic and VB.Net.
|
|
|
|
|
Visual Basic refers to VB.6 (Visual Basic 6) and VB.NET refers to the updated CLR freindly and SUPPORTED version for the utilising the power of the .NET framework.
Do not be tricked into using vb.6...
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
There's more than one.
Think of it like this VB6 is to VB.Net as Latin is to Italian.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
VB.Net is what developers use.
VB6 is what students in India appear to be using.
Most of the quesions relating to VB6 seem to come from the subcontinent.
VB6 is no longer supported, so use .net version.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
In one line, VB6 is 'unmanaged' code - VB.Net is 'managed' code.
Internally there are tons and tons of differences.
|
|
|
|
|
It's not quite what was posted as answers so far...
VB.NET is the term that used to be used for the .NET implementation of VB from its first version in 2002 up to VB8 (VS 2005) - Microsoft now just calls it either "VB" or "Visual Basic" (check Microsoft's web site or the 'About' screen for the product).
You can't be sure just from the term whether someone means the .NET version when they say "VB" or "Visual Basic" since both of these terms were used for VB6 and are now used for the latest VB.
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
The main difference is that Visual Basic 6 or earlier was terrible and VB.NET is the greatest thing since penicillin.
If you are considering learning one or the other go for .NET much better language IMO.
Personally I have seen the same code written in VB6 vs .NET and the .NET code is about half the lines of code to do the same thing.
Humble Programmer
|
|
|
|
|
If the 'Visual Basic' is the VB6 I know, then
The difference between VB6 and VB.NET is the way VB6, VB.NET pass the address
or memory space of your data when you call an external Function in a DLL.
1) VB.NET obey the rule passed by value (ByVal) and it will copy the entire
image of your data and pass the address into your external Function (in a DLL, etc).
2) VB6 does not do that. The proof of this is your Function can manipulate the
data (Often a ByVal String) and when the function return, the VB6 can see what
was changed with that space.
3) I like this VB6 behaviour for peace sake. Lately, I had a DLL use in VB6 and
ported it into VB.NET and It does not work the way I know it, only to find-out
I had to create another Function that accept a pointer to String address,
(char **) in C/C++, Or create a public structure and put all those String
variables that previously use as pass ByVal in VB6 application---lots of work,
but that what porting is about---to make your existing codes
work on another environment.
TMALBONPH
|
|
|
|
|
I have an MCQ based quiz built in VB 2008. I want this quiz to be played by other people on my website. How can this be done. I have Dreamweaver CS 3 for web.
|
|
|
|
|
Razanust wrote: How can this be done.
In a variety of ways, but I'd suggest using ASP.NET and XML. There's a CodeProject article here[^] to get you started.
I are Troll
|
|
|
|
|
I have written a WinApp that can be launched from AutoCad. If I run it with no parameters it works just fine displaying the dialog box. (path\test.exe)
If I add a parameter for a lookup table the launching app gets a hyperlink not found error. (path\test.exe 1234)
If I place a # in the path (path\test.exe#1234) the app runs but can not find the parameter 1234.
Is there something I need to add to my code to recognize the 1234 in the args string in the my WinApp?
Thanks...
|
|
|
|
|
MacIntyre wrote: Is there something I need to add to my code to recognize the 1234 in the args string in the my WinApp?
I don't have AutoCAD, so I can't verify my claims here.
path\test.exe 1234 That one doesn't seem to exist, as you stated, it tries to locate the file "text.exe 1234", which indeed doesn't exist. You could try to put the filename in quotes, like this;
"path\test.exe" 1234 That should be enough to make a distinction between the file (allowing AutoCAD to test for it's existence) and the parameter. It's not guaranteed to work; some programmers take the entire input-string and assume that it's a file that must exist.
MacIntyre wrote: f I place a # in the path (path\test.exe#1234) the app runs but can not find the parameter 1234.
There the target exists, but I guess that "#1234" has become part of the filename and no longer counts as a parameter. You could check whether args[0] contains both the filename and the parameter - if it does then you could perhaps work around the limitation by splitting the filename on the "#"-character.
Good luck
I are Troll
|
|
|
|
|
How would I get a program to show the numbers it adds up? Say the user wants the program to add numbers 1 through 10. How would I get the result to show up as "1+2+3+4+5+6+7+8+9+10=55"? I dont have a problem getting the program to add the numbers or anything. I just need help displaying the result, if it's any help I'll be using a loop. If I havent explained myself well enough let me know. Thanks
rawr!
|
|
|
|
|
you want the output to contain two things: a string representing the operands and operations, and the evaluation result.
Hence your loop should contain two things: a concatenation adding the latest operator and operand to the symbolic string, and an addition adding the addend to the partial sum.
|
|
|
|
|
Module Module1
Sub Main()
Dim txt As String = ""
Dim arr() As Double = {20, 11, 34, 25, 55, 89}
Dim tot As Double = 0
For i As Integer = 0 To 5
If i < 5 Then
txt &= arr(i).ToString("0")
txt &= "+"
tot += arr(i)
Else
txt &= arr(i)
txt &= "="
tot += arr(i)
txt &= tot.ToString("0")
End If
Next
Console.WriteLine("Output: {0}", txt)
Console.Read()
End Sub
End Module
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
We have a windows project in VB.NET 8 (2005) for a couple of years.
Now it just seems that the modules and code behind forms have a colon and a number after them in the tabs with the name. i.e. module was frmWebUpload.vb now shows in tab as frmWebUpload.vb:1 and frmWebUpload.vb:2
In addition, when editing these modules with the colon then the events and procuderes have empty in them. The normal modules would have a functional drop down.
Can anyone tell me why and how to fix it?
Thanks
|
|
|
|
|
I wonder if that is the designer and code files separated. There is a button at the top of the solution explorer that turns on or off show all files I think if you have this on the files will show as you are saying and not otherwise.
Humble Programmer
|
|
|
|
|
Hi guys,
I don't know if you already seen this video about Visual Studio 2010, but I think it's pretty useful meanwhile MSDN subscription arrive.
|
|
|
|
|