Ending A Sub Program?
Oct 9, 2010I am writing a program in which I am testing a user's text box input. If it does not meet the required criteria, how do i end the sub program without closing the entire application?
View 3 RepliesI am writing a program in which I am testing a user's text box input. If it does not meet the required criteria, how do i end the sub program without closing the entire application?
View 3 RepliesHow do I End a program without a button?I just want to use the Windows X button rather than having a button on the form.
View 2 RepliesI have a program that will run in the tray and have the close button disabled to prevent the user from closing the program (I know they can still kill it from task manager).I was wondering how to detect a logoff/reboot/shutdown to run a closing code. [code]
View 3 RepliesI have written a converting program, which converts binary files to ASCII files. (VB.net 2010). I need to have a functional "stop" button on the form and I was wondering if there was a simple command to make a program stop, exit all procedures, and wait for user input on the form.
It is not feasible to multithread this application, as it frequently interfaces with the form. Currently, I have a global boolean variable which becomes true if the stop button is pressed, and I have internal loops checking to see if the variable is true. However, I don't to waste CPU on checking a variable if it's not necessary.
In VB6, I've learned why I should not used "END" to close or terminate a program. Does that rule still applies to VB .NET? (.NET 2003 if that makes any difference)
What is a proper way to close a VB NET program while ensuring that all forms that are either visible and or invisible at the time of termination gets unloaded from memeory, and all used resources gets released?
I am using Visual Basic 2010 and I am makeing a simple login app it prompts you for a username and password if it gets it right I want to open a form then close the previus one but when I do me.close it ends the program and I can't go on I am positive its working because I get the right password and username ut I can't close the first windows I tried to hide it but when I do I cant close it and the program goes on without quiting and with a hidden form I heard rumers that there is Sub that can control the x in the corner if there is one that would probably solve my problem but I can't find it heres the code for the login form
[code]...
I have the following code to insert some data from a GridView to a oracle database.
Protected Sub btnInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInsert.Click
Dim con = New OleDbConnection("Data Source=sml2; User ID=sfpl; Password=a;
[code]....
When I create an instance of an Excel Application class and then quit the app and release the object (like below) the EXCEL process is still running in the the task manager. I have built an algorithm to find the process id and kill the process through that but I shouldn't have to.
xlApp = New Excel.ApplicationClass
'do stuff with excel app class instance
xlApp.Quit()
[Code]....
I'm writing a class library and I need to be able to shut down the main code in certain cases.
I know I could raise an event and listen for it in the form called by application.run but I would like to find a way around it.I wouldn't be opposed to try to throw an exception that if unhandled would close the application... but would prefer to come up with a more elegant soln.
I converted this app from VB6. I have 2 forms. Form1 instantiates Form2 via a Menu Item.I am having trouble getting Form2 to end when clicking close (X). If Form2 is 'idle' it closes fine; but if I am in a loop processing anything all the events fire, but it continues processing in Form2. I've tried messing with Dispose, Close, Application.Exit, Application.ExitThread. My last attempt was creating my own event to fire back to Form1 and dispose Form2 -- and it hits it but Form2 is still running. What is the deal? BTW if I use just Show vs ShowDialog -- Form2 just blinks and disappears.[code]
View 2 RepliesI converted this app from VB6. I have 2 forms. Form1 instantiates Form2 via a Menu Item.I am having trouble getting Form2 to end when clicking close (X). If Form2 is 'idle' it closes fine; but if I am in a loop processing anything all the events fire, but it continues processing in Form2. I've tried messing with Dispose, Close, Application.Exit,pplication.ExitThread. My last attempt was creating my own event to fire back to Form1 and dispose Form2 -- and it hits it but Form2 is still running. What is the deal? BTW if I use just Show vs ShowDialog -- Form2 just blinks and disappears.
Form1 does this
Dim f2 as Import
:
[code].....
Why is my beginning for each statement linking to the wrong ending next statement take a look at the code. The for each shipment is linking to the end next comp statement. My head is cracking open over this.
Dim getshipments = From s In mydb.ships _
Where s.ship_dte.Date <= month And s.ship_dte.Date >= month2 _
Group s By s.shipid, s.ord_num Into g = Group _
[Code].....
My look-behind: (?="","") is not working. This is due to the fact that I use .+ before it because I am parsing messages in a chat room where the users can literally type anything. The return is as follows for an example:
[Code]...
This depicts the beginning which contains the chat topic plus two messages. how exactly I would go about parsing the message out?
In the same line of this thread Now i have a problem with the control of the ending threads. This is my
vb.net threadsEnded = 0 For j As Integer = 0 To numThreads - 1
[Code]...
Some times the application doesn't finish and if i pause the application i see that the threadEnded var doesn't have the correct value, seems like some thread doesn't update the value of the var.
I am using a sub procedure that calls other subs. I was wondering if there was a way of ending the main sub from one of the called subs.I have been using Exit Sub but this only exits the sub which is currently in.
View 3 RepliesI have a small project which I want to add a different text at the beginning and the ending of each line in a multiline text box.I've tried this, But It only let me to add it at the beginning ( because I don't know the length of each line And also I have to write a code for each line which is very hard because the text box may contains 200 lines Dim lines() As String = TextBox1.Lines lines(0) = lines(0).Insert(0, "Hello World")TextBox1.Lines = lines I want for all lines without having to repeat it again for each line
View 7 RepliesIm trying to do a playbook application in vb.net. My problems is I dont know how to animate the pictureboxes. Im supposed to let them move once I play the animate button. Lets say i have a picture box with coordinate 20,30 and i would like it to move on run time to 450,300. how do I do it?
View 10 RepliesI would like to ask some help in my project. Im trying to do a playbook application in vb.net. My problems is I dont know how to animate the pictureboxes. Im supposed to let them move once I play the animate button. Lets say i have a picture box with coordinate 20,30 and i would like it to move on run time to 450,300.
View 1 RepliesI was wondering if there was a simple explanation for the fact that most of the balls in the following code seem to end up on the left side of the screen....
Code:
'***********************************************************************
' Assembly : Balls
' Author : FOlphen
' Created : 01-28-2010
[code]....
how to create a list of the contents of a folder (T:ENERGY) using *.pdf as the filter. Also could this be adapted to read folders names and place that into a string ";" delimited to be called upon and modify T:ENERGY)?
View 6 Repliesit was regarding in vb.net text operations, i want to replace the text by finding some particular text.but the problem arises when the starting and the at the end delimiter of the string is something same every-time but middle thing keeps on changing so how can i work out with that?? str = Replace(str, "abcdparameter = xyz123;", "abcdarameter = my defined parameter;")
i tried to learn some regular expressions but i am not able to get that.the xyz 123 is same every-time....and also there is one delimiter at the end of the parameter string so anyhow you can select the whole line and replace it.
I want to make a very small program where the user inputs a starting time and an ending time that is in "clock time (?)" and the program converts it to total minutes in one box and a decimal total in a second box. I have 4 textboxes, 2 are masked text boxes (military time) for input and two are not, for output and the math is coming out weird.
If I put a start time of 0925 and an end time of 1015, the results I'm expecting would be 50 total minutes and .83333 total as a decimal. I don't think I'm converting the textbox input correctly as I'm not getting anything near that. I am using a button to calculate and another to clear the boxes, just FYI. Also, I'm not sure what to do about any times that span the noon hour except to use an absolute value.
Public Function Time()
Dim StartTime As Double
Dim Endtime As Double
StartTime = txtStart.Text
Endtime = txtEnd.Text
txtDecimal.Text = (Endtime - StartTime) / 60
txtMinutes.Text = Endtime - StartTime
End Function
I found out that I can start any external executable using:
[Code]...
If txtLog is a RichTextBox control:
Dim text = "hi" & vbCrLf
Debug.WriteLine("t:" & text.Length) ' --> 4, as expected
txtLog.Text = text
Debug.WriteLine("tL:" & txtLog.TextLength) ' --> 3. muh?! :(
Having looked at the RTF spec, the end of a paragraph is notated as par, which is neither CR nor LF. This makes sense since RTF is markup language; like in HTML, line endings have little meaning on their own.
So presumably, on writing into the RichTextBox, my line ending is being encoded into par. And then, on extraction, the par is being translated back to a real line ending for use.
It turns out that this line ending is vbLf.
Why, since Microsoft near-consistently employ CRLF for line endings, would RichTextBox translate par to vbLf instead of vbCrLf?
I have the following function - the purpose of which is to resize a form so that it shows the entire contents of the grid on the form, provided the grid isn't so big that the form gets wider than the screen itself.
Public Shared Sub ResizeFormForGrid(ByRef F As Windows.Forms.Form, ByVal DGV As Windows.Forms.DataGridView)
Dim GridColumnsWidth As Integer
[code].....
I have a class that's getting an XML document from a URL. I've verified that the XML from the URL has an newline at the end. For some reason, though, this newline is stripped off before being fed back to the user, which is causing an mal-formed XML error when the users feed this XML file into other programs.
Dim reader As XmlTextReader = Nothing
Dim filename As String = _partID & "_" & _majorRev & "_PreCheck.xml"
Dim localFile As String = fileDialog.FileName
Dim URLString As String = _env.HTTPInfo("stwebservices").UriBase & "PreCheckXMLReport.aspx?partId=" & _partID & "&rev=" & _majorRev
reader = New XmlTextReader(URLString)
[Code]...
I'm using VB.Net in an ASP.Net 2.0 app to run some regular expressions that remove some unnecessary markup. One of the things that I'd like to do is remove span elements that don't have any attributes in them:[code]I'd like to remove the outer span elements. Unfortunately, my regex above gives me this as a result, since the closing span matches the first one it comes across:[code]
View 4 RepliesI wrote a program that writes to a new created file a line of text. Anytime I try to open the new created file, I see a dialog box titled "Inconsistent Line Ending". I do understand why I receive this message. I wrote this program in VB.NET.
View 1 RepliesI have a completely basic program here that I want to simply take text from a textbox and the selection from a combobox, and then run the following:
CODE:
Obviously WKID and PROCESS are the variables it will be pulling from the data that was put in by the user. That code was just in a simple batch file that I made with 2 variables. I am wanting to pull those 2 variables in when clicking the "kill process" button, it will run a command simliar to the above and end a process on a remote networked computer.
I have a two buttons: Previous Week & Next Week When i run the app the LabelDate needs to shows up "May 31, 2010 - June 6, 2010" When i click a previous week button i want to set LabelDate's text to "May 24, 2010 - May 30, 2010" If i click Next Week button i want it shows up "June 7, 2010 - June 13, 2010" Means it should always display previous/next week starting from Monday and ending with Sunday.
View 4 Replies