Use Of Exit Sub For Structured Programming ?
Feb 22, 2010
I have a pesky (i.e. A.R.) code reviewer where I work that says that Exit Sub is equivalent to the Go To statment in COBOL and is not structured code. I see nothing wrong with the Exit Sub statment as it eliminates messy If statements.
View 3 Replies
ADVERTISEMENT
Jan 20, 2010
I'm developing a program using VB 2005.I've tried to use the following instructions to "kill" the application
Application.Exit()
Environment.Exit(0)
(not at the same time)
[code]....
View 6 Replies
Jun 12, 2007
I'm having a bit of a problem getting my application to close properly. Basically I have one main form from which all other forms open. If a user tries to close that main form, I want to bring up a MessageBox asking if they want to exit the application.However, when I try to do that it asks the question twice. It seems that the Application.Exit() is triggering the FormClosing event again for some reason, but I don't know of another way to exit the application. BTW, the main form isn't the startup form so I can't use the option to close when the startup form closes.
View 9 Replies
Dec 9, 2011
Now I have a sub to validate a bunch of textboxes and combo boxes.I previously used many IF statements to validate and pop up different messageboxes and Exit Sub in every IF statement.But I heard that too many Exits will decrease the efficiency and they were not recommended to use. Instead, nested IF is better because it will let the process naturally go to the end.Then I found out that if I use nested IF,it will be hard to read, since messageboxes are all separated from conditions.
View 2 Replies
Jun 17, 2010
How do I exit from the recursive loop from the code below. I would like to notify the end-user to select a checkbox in a msgBox before I exit the loop.
[Code]....
View 1 Replies
May 30, 2009
what is the best solution to save data in structured storage?
i need this for a wpf application
View 4 Replies
Apr 7, 2008
I am trying to add structure (line breaks, paragraphs and code) to the Remarks Tag of XML documentation in VB2005. I have tried many examples from "Recommended XML Tags for Documentation Comments (Visual Basic)" [URL], but all of the examples seem to compile to one continuous line when viewed in the VS2005 Object browser.
Below is an Example:
[Code]....
View 1 Replies
Nov 27, 2010
A convenient way to store structured data is to use classes.While classses offer a very good flexibility they have a big drawback that they increases the quantity of disk space
View 4 Replies
Sep 25, 2011
I once was able to insert a Class-Header type XML comment section which structured the describing of a class; I now cannot remember how I did it. I think I either used a snippet or some macro-type character combination that inserted some XML documentation fields which made commenting a class well structured. It may have even been an extension.
View 3 Replies
May 22, 2012
I need some input on what I'm doing wrong. What I have so far is an order form program where customers input their information and what they want to buy. Now, what I'm trying to do is take the customer information, store it in an array, write the customer information to a file, and then when I open the order form, it loads the customer information file and automatically fill in a display box on another form with all the customers and the information.I want each customer in a file to be stored on one line. Like so: (Name, address, city, state, zip)
Mike-123 E Dream Rd-Denver-CO-99558
Jane-234 E Code Rd-Seattle-WA-99458
Then when the file is read, to read it, and add each name to a structured array (customers(NumberOfCustomers).Name, customers(NumberOfCustomers).Address, customers(NumberOfCustomers).City, customers(NumberOfCustomers).State, customers(NumberOfCustomers).zip).
After it has all been added to the array, all customers in the file, I want to loop through the array and display each customer on a new line in a listbox, which opens in another form.So far, everything works IF I don't write to a fail. If I store the customers in an array and use a loop to display the customers in the listbox, all is well. However, when writing to a file and trying to read it back into the array is where I've hit a problem. The following code seems to work well, however, it just reads the first line over and over as many times as there are lines in the file, and displays all those using the loop. I just need a way to loop through the lines and store each line into each structured array for each customer, instead of read the first line 12 times over into 12 different places in the array.
[Code]...
View 1 Replies
May 10, 2011
Anyone out there who happens to have an exhaustive code snippet for SEH (including all possible exceptions) for VS 2008 or VS 2010 (.NET 3.5 or 4.0) ?
View 10 Replies
Sep 1, 2011
i'm having trouble reading a slightly different structured xml file , it looks like :
HTML
<?xml version="1.0" encoding="iso-8859-1" ?>
-<VESSELS>
<vessel MMSI="205416000" TIME="2011-09-01 09:31:16 GMT" LONGITUDE="3.19722"
[Code]....
I do need the different fields like time / lontitude e.d.
View 1 Replies
Nov 12, 2011
how to read this file into my structured array. it's a 'quiz generator' program. i have a .dat file with a set of 10 questions, and i need to load it into my structured array:
vb
Structure testQuestion
<VBFixedString(100)> Public question As String
<VBFixedString(30)> Public choiceA As String
[Code].....
View 25 Replies
Aug 13, 2011
I can create a Custom UserControl with simple properties (Integer, String, etc) and have those properties show up in the Property Panel. I can also create a Custom UserControl with properties like Size, Rectangle, etc and the properties will show up as an expandable item in the Property Panel (click on the '+' and the Size expands to Width & Height).
Is it possible to create properties with my own custom structure? e.g. Property 'Message' expands to Text, ForeColor, BackColor, Blink etc. I have tried creating a property that references a simple class or structure with containing the properties representing my custom structure but in the Property Panel the property is greyed out and cannot be expanded or modified.
View 1 Replies
Jan 12, 2009
Code:I have this issue ....in asp.net 2.0 MSVS 2005 ' I said user control, I mean web control ..ie ascx page in asp.net
1 STRUCTURE MyStruct
2 X as Integer
3 M as double
4 Z as string
[code]....
View 4 Replies
May 12, 2011
I am trying to make the lookup button match abbreviation to name or vice versa. here is what I have so far.
Public Class FrmState
Structure State
Dim stateNameString As String
End Structure
Structure Abbreviation
[Code] .....
View 9 Replies
Apr 23, 2010
I have a DataGridView in a Winforms application containing a collection of items. Each item has an image and various other details. I know it is possible in WPF, but can you get a tooltip to display an image and a more structured set of details then just plain text?
View 1 Replies
Aug 20, 2010
I have just done my program, just skeleton not completely, the final problem has not been solved up to this time.When I run my application, the Icon of its will be showed at TaskTray. I would like the icon is there when I exit fom of application and then If I double click on the Icon, the application will be showed.
View 5 Replies
Jun 15, 2010
I'm currently learning VB.net and can confidently connect to databases and return results to comboboxes run stored procedures ect to datagrids, However I'm wanting to find an online tutorial for doing loops with data so for example
I return the following data into a dataset
Orderno Orderitem Price GUID
111 Pies 1.50 xxx-xxxxx-xxxxx-xxxxxxx
111 orangutang 2.00 xxx-xxxxx-xxxxx-xxxxxxx
ect
I want to display each element on a page in a structured format so as to make a visual representation in seperate entities (labels maybe) of the data like so:
Order number
line 1 (includes item and price in plain text on a page i guess using a label)
line 2 (same goes)
Subtotal( )
The results and formulae i can do but it's simply how to split off the data from my dataset and display elements as seperates (also how will i dynamically create the lables as obviously i'm not going to know in advance how many order item rows will return )
Obviously this is not urgent but if anyone could point me at a tutorial or even better a few lines of code that will do this for the microsoft northwind data so i can mess about with it and play.
View 3 Replies
Jan 28, 2012
I have recently taken a liking to programming, and have programmed a few games in C#,my friend has asked me to program an application for him to use in his shop. But I have no idea of what language is best suitable?
View 8 Replies
Mar 2, 2010
I'm currently working on my (business) master's thesis... the topic is capital budgeting tools to manage major investments for a European energy supplier.So far the company has used MS Excel for calculating relevant data to make decisions on whether to invest money in new projects or abandon them. There usually is a host of input data, lots of basic calculations and just two or three outputs (such as Net Present Value, Return on Investment etc) .It is my task to develop a new excel template or decide on buying a completely new software license, if excel proves unable to provide the functionality the company needs.
So far I have only very limited programming knowledge, stretching to Java basics, some HTML code and SQL Databases.However, a colleague hinted at the fact that the VB.net programming language can be easily learned and used to improve excel considerably. Ideally I would need excel to be able to:
- make sure people putting data into our template don't mess with it
- be able to communicate with a database
- have an appealing, structured and neat appearance for ease of usage by people with limited IT abilities
- provide all output, including sensitivity analysis charts, in a structured, printable overview
View 6 Replies
Oct 30, 2011
I avidly create games in VB.net. Being a hobby programmer I give my games away for free. Since I'm a hobbiest without formal training I do try and educate myself on proper programming principles and follow them when programming such as OOP. There are however some things I have obviously missed being self-taught that perhaps I would know if I were formally educated. Once such issue that has really been my bane is how different classes (from now on referred to as objects) 'know' about each other WITHOUT programming specific interaction.
Okay imagine this, you have a space game and the following objects
[CODE]...............
Now each one of these objects has a Health, X,Y and Z private members and properties that are all inherited from clsSpaceEntity for argument sake. Now one way of programming collision between them would be to code out the following logic in the main game loop
[CODE].........................
Now this might seam okay if your talking about the simple example above but some of my games have tens or even HUNDREDS of objects that interact in this basic way. Is there a way in OOP to do the following... for each thing that inherits from clsSpaceEntity check against every other object that inherits this type (except itself) and if they collide then reduce health next? This sort of ability for a type of objects/class or whatever to be 'aware' of another and how they are the same/different and interact would save me tonnes and tonnes and TONNES of coding.
View 1 Replies
Jan 25, 2012
How to exit from iframe?.I have a pages called "Master.aspx","Parent.aspx(inside that iframe is there)","Child.aspx".I am calling "Child.aspx" inside "Parent.aspx" page using iframe.If "strBillingAddress1" is null then i need to redirect to page Master.aspx".It is redirecting but showing inside iframe.I dont want this behavior.I need to open as new page itself?This is the code.
If String.IsNullOrEmpty(Session("strBillingAddress1")) Then
Response.Redirect("Master.aspx")
Response.End()
End If
View 2 Replies
Nov 20, 2011
How can i exit a for each statement i mean say i had the code below (not real code its sudo code)
CODE:
but i don't want to exit just this for loop i want to exit the previous for loop at line 1
CODE:
View 14 Replies
Dec 8, 2009
I have the following code which gives me an error at run time. The problem is when TxtSearch.Text - is not an integer a message box should be prompted saying- Only a numeric value is allowed in this field, otherwise continue with the sub.
Private Sub ButtonSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSearch.Click
Dim query As String
[Code].....
The error I receive is showing ''saved_prac = cmd.ExecuteScalar()''..
First it brings the Message box - Only a numeric value is allowed in this field. When I OK it, then it brings another message box "error converting data type varchar to numeric". When you click OK the application crashes...
View 6 Replies
Mar 30, 2010
I have this program and I want to put either a Quit button or Exit Button to quit the program (besides using the 'x' at the upper right corner)
View 3 Replies
Jan 4, 2011
I have a VB.NET form (CopyScenarioForm) with a OK button (DialogResult property = OK) and also assigned it as 'Accept Button" for the Form.
I show this form from my main Form (mainForm) using
If DialogResult.OK = CopyScenarioForm.ShowDialog() Then
DoSomething()
End if
Now when user clicks on the CopyScenarioForm.OK button, I want to validate his entries and if invalid I want to 'Exit Sub' from the OK button's click handler but when I do that the form still closes out and DoSomething() gets executed. Is there a way to stop this and keep the form alive and only exit if the inputs are valid. I noticed, if I change the OK button's DialogResult property to 'NONE' instead of 'OK' then it doesn't cause it to close. but then how Do I know how the user exited the form to execute DoSomething().
View 2 Replies
Jan 10, 2009
I have been playing with adding labels and text boxs to a form by using code I would like to add a exit button
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Text = "InputCode"
[Code]....
View 3 Replies
Aug 11, 2010
I have done a lot of searching and cannot find a solution to my problem of, my application appearing in the processes even after exit.
Note: It doesnt appear in the processes due to the type of exit i have used after the click function happens.
Public Class FCAM
Public Sub Launch(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Launch_FCAM_FarCry.Click
Process.Start("....Bin32FarCry.exe", "-MOD:FCAM")
System.Windows.Forms.Application.Exit()
[code]....
View 1 Replies
Aug 5, 2011
I have recently implemented to following code on a good deal of my forms.
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function
It has worked great to solve some of my odd application hangs when the application has been running > 1 week.However, when the user closes the program I now get an Application Crash screen.how to stop this? how to put it back to "normal" with a global variable?
Public Overrides Function InitializeLifetimeService() As Object
if readytoExit then
' Return... not nothing?[code]......
View 1 Replies