Refactoring - Possible To Simplify (refactor) My Program Code (VB 2010)?

Jun 27, 2012

I have created a simply Pizza program (for a summer project not education related) that uses check boxes to determine what the customer wants. Basically a simple pizza ordering program.I was wondering as I have used the If statement over and other again for different parameters and variables, is it possible to use multiply arrays to simply the VB Code...I was advised to use Constructors in VB.Net Or is there a more simpler way to go about creating this program...or a better way of programing?What about decreasing the repetition in the code?

[code]...

View 4 Replies


ADVERTISEMENT

How To Simplify The Code

Jun 8, 2012

I was just wondering how you would go about simplify this code as its getting very annoying manually going through and changing the index value for the arrays.

[code]...

View 1 Replies

Can Any One Simplify CrazyPennie CODE

Nov 7, 2009

In my Previous Thread < My First DATA Base Application > About DATABASE Crazypenie Give me Code:[code]

View 7 Replies

Refactor To Remove Code Duplication?

Feb 1, 2011

This is a simplified version of a class that I have in my project. Since the Bonus is figured the exact same way in each function I want to remove the obvious code duplication that appears here and make the three different functions into one. However I am not sure how to provide the argument that this new function would require.

For instance I am currently just passing the argument like this from code

lblVolumeBonus.Content = TestClass.VolumeBonusAmountStore(bonus).

I think I have to basically turn this logic around and call it with something like

lblVolumeBonus.Content = TestClass.VolumeBonusAmountStore(BonusTrackerBO.StoreBonus)

but I am not sure of the correct syntax or whether I am on the right track at all.

Public Class TestClass
Public Shared Function StoreBonus(ByVal bonus As BonusTrackerBO.StoreBonus) As Double

[Code]....

Edit: It may not make a difference but I should have made clear that there are other factors in the equation (I was just trying to keep it simple). So is the answer the same when there are other callbacks to the bonus like bonus.MaximumAmount, bonus.MinimumAmount? There are 5 callbacks to the bonus object and the amounts are different depending on whether it is a Store, District or Company asking.

View 2 Replies

Simplify And Optimize This Checksumming Code?

Jan 27, 2011

Public Function CalCheckSum(ByVal ByteList As List(Of Byte)) As List(Of Byte)
Dim total As Integer = 0
For Each b As Byte In ByteList

[code]....

View 1 Replies

Simplify Code For 3 DataGridView Controls In Winform Application?

Jun 6, 2011

I have following code for 3 DataGridView Controls in my VB.NET winform application. How can I simplify this code?

With DataGridView1
.Columns.Add("Column 0", "TaskName")
.AutoResizeColumns()[code]........

View 3 Replies

Prevent Data Layer Refactoring Of ODP.NET Code And Transactions?

Aug 27, 2009

I am using Oracle 11g client, with ODP.NET. I am trying to add conditional Transaction handling.

Dim ds As New DataSet()
Dim txn As OracleTransaction
Dim _beginTransaction as Bolean = true
Using conn As New OracleConnection(ConnString)

[Code]...

How do I fix txn being nothing / null? The error is: Variable 'txn' is used before it has been assigned a value. A null reference exception could result at runtime. Edit: to RichardOD for pointing out that you can not explicitly declare that a transaction cannot be opend up on stored procedures via ODP.NET. I have verified that this is an issue. BUT We still haven't figured out why the error is occuring. I understand that txn is initially given a value w/in an if statement, but being defined outside of the try/catch block should make that irrelevant.... right? Or is that bad coding?

View 3 Replies

IDE :: Why Doesn't In Visual Studio 2010 Have Any Refactor Support

Jul 3, 2009

Why doesn't vb.net in Visual Studio 2010 have any Refactor support

View 14 Replies

VS 2010 Class Refactoring?

Feb 21, 2011

This is my scenario. I am writing an app which takes a person object and a features object , when the user selects a person object a features object is created. This works for any amount of features i care to display. So far so good, i am now refactoring to create 2 additional classes, a maths class and a ui class. my issue now is how do i get the maths functions to know the instance of the features object(s) or person object(s)?

Unfactored
Public Sub New(ByVal feature1 As New Feature)
...

[code].....

View 2 Replies

How To Use VB - Design A Program - String, Data Enadled Application And Refactoring

Jul 20, 2008

Dont understand where to start on visual basic iv been leaning alot about computers over the months and i would now like to design a program and to be honest its all new and i dont no where to start or what any of these woulds mean like string, data enadled application and refactoring.

View 3 Replies

IDE :: No Free Refactoring Support For .NET In 2010?

May 21, 2010

Have we moved from "Being forced to go install a 3rd party add in to get what C# users have" to "Being forced to go buy a 3rd party add in to get what C# users have"?

Why did MS see fit to get DevExpress to create Refactor! for the previous versions of VS, but not for 2010? Or am I missing something?

View 3 Replies

Refactoring Options In Visual Studio 2010 Differ Between C# And VB

Oct 14, 2011

In VS2010 C#, when I right-click there is "Refactor" menu with following options:

[Code]....

Are these options available in VS2010 VB.Net? All I can see is "Rename" when I right click?

View 1 Replies

VS 2010 Code Works In One Program But Not The Other?

Nov 23, 2010

I have a program that uses the mouse to find window captions. I made a test program that just does that and it works fine. I copied and pasted the code into my other program and it doesn't work. The mouse position changes, but it will only get the caption of a window if it is at the top of the screen. It seems that only the Mouse.X position is changing, but I put the MousePosition.X and Y in a label and they are both changing. Can anyone explain why this is happening?

[Code]...

View 6 Replies

How To Simplify Loops

Dec 5, 2011

I would like to simplify a do loop.

View 1 Replies

Simplify My IF Statement?

Mar 10, 2010

So I have here a sub, that is called to check values in my program. It works as it is, but it is a very long line of code. I know there must be a way to simplify this. As long as it uses fewer than 10 lines (even though this is 3 lines, split up. Same thing in reference).

If (btnArry(1) = btnArry(2) And btnArry(2) = btnArry(3) And Not btnArry(1) = Nothing) Or _
(btnArry(4) = btnArry(5) And btnArry(5) = btnArry(6) And Not btnArry(4) = Nothing) Or _
(btnArry(7) = btnArry(8) And btnArry(8) = btnArry(9) And Not btnArry(7) = Nothing) Or _[code]....

View 12 Replies

Create Code Snippets For Program In 2010?

Sep 6, 2011

Boss wants us to start adding uniform comment headings to Functions and Files, so I tried to write some snippets to do it, but I can't get it to work.[code]...

View 2 Replies

Simplify The Handles Clause In A Sub?

Nov 14, 2009

Is there a way to simply the Handles statement? What if i want this sub to handle 20 textboxes do I have to list each textbox there? I already have a loop in my script so i can cycle through my textboxes ("TextBox" & i.text). is there anyway to use a variable or a function after handles to get all the names of the text boxes?

Private Sub textChange(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress,TextBox2.KeyPress, TextBox3.KeyPress, TextBox4.KeyPress, TextBox5.KeyPress

View 8 Replies

C# - Refactor Data Contracts In WCF Services?

Feb 11, 2010

We have lots of WCF services that are only used by our own code; the code that uses them is mostly in the same solutions files that contains the services.

However they do not use a shared assembly for the contracts, so each time a data contract is change the reference to the service has to be updated by hand in all projects that use the service. (Then the code needs to be fixed up by hand)

So how do I do a simple refactoring like renamed a data item in a data contract?

Is there a way to update all references to services in a single solution with one command, rather then having to click on each reference in each project?

View 2 Replies

IDE :: Get Refactor To Appear In VS 2005 And VS 2008 On The Same Machine?

Jul 30, 2008

I downloaded and installed Refactor. The install worked fine and Refactor works in VS 2005. However, I also have VS 2008 installed and I cannot get Refactor to appear in that IDE. Is there something I need to do to get Refactor to appear in VS 2005 and VS 2008 on the same machine?

View 7 Replies

[2005] Anyone Use The Built In VS Refactor Tools?

Feb 26, 2008

I was fooling around with the toolbars and noticed the Refactor section. So I made a toolbar with all of the refactor buttons and ... they don't do anything.I don't often customize so maybe I'm missing something.

View 6 Replies

Integrate A Paypal Program Code In 2010 Form?

Jun 8, 2012

I have a VB windows form for users to put in their payment amount and credit card information for direct payment. I have downloaded the .NET and Java code snippet from paypal for direct payment.How do I integrate the .NET or Java code into the VB form. Finally, how do I pass the parameters from the form to the snippet code.

View 3 Replies

VS 2010 RGB Code - Changes The Background Color For My Program And Then Save It

Apr 2, 2012

I made a simple code that changes the background color for my program and then save it. But for some reason, it will not work if the RGB code has 255 in it.

Public Class Form1
Dim R, G, B As Integer
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
R = TextBoxR.Text

[CODE]........................

View 3 Replies

Asp.net - Simplify Email Body In String?

Oct 20, 2009

I'm just wondering about this one. I'm creating an ASP.NET webform containing lots of textboxes etc. And I want to send an e-mail based on this stuff. And the e-mails body needs to go into a string. And the string is supposed to contain HTML code, but the syntax changes because of the string. So how can I simplify this? Is there any software or something that lets me do this? Perhaps paste in some HTML code and then convert this to string format, ready to use with vb.net?

View 2 Replies

Refactor - Replace With Constant String.Empty

Oct 17, 2011

I have the following line of code
Dim a As String = ""
And the Refactor suggests replacing the "" with String.Empty
It is a kind of Refactoring but why? Since I am a newbie in the future declarations of mine should I better use the String.Empty ?

View 5 Replies

VS 2008 Refactor All Instance Variable To Have All The Get And Set Method?

Jul 17, 2009

how do I refactor all my instance variable to have all the get and set method? I tried RefactorVB but it seems like it can only refactor 1 by 1.

View 2 Replies

Why Visual Studio Does Not Have Refactor Tool By Default

Aug 20, 2010

why visual Studio Does not have Refactor tool for vb.net by default ? but it has this tool for c#. for example extract method and etc.

View 2 Replies

VS 2010 - With VB Code - Program To Subtract 20% When A Non Profit Check Box Is Ticked

Oct 8, 2010

I'm working on a problem for my class, I've been stuck on this for hours so I've determined I would post here

I need the program to subtract 20% when a non profit check box is ticked (chkNP in my case)

I have the rest of the app functional:

CODE:

Basically the application is a tool or determining the cost of packages from an ISP

Package A: 10 hr access. $9.95 mo. $2 each additional hour
Package B: 20 hr access $14.95 $1 each hour
package C : unlimited. $19.95 a mo

So basically the app needs to apply a %20 discount to each of these when that checkbox is ticked

View 7 Replies

Simplify A Weekly List Of Events For A Web Site

Aug 17, 2009

I am writing a program to help simplify a weekly list of events for a web site without having to manually edit HTML code every single week.

The program takes event information from the user, stores it in a list box, and generates HTML code based on the user entry. The program basically enters in the user's inputted fields into a pre-set HTML template.

Here's how it's done:

1) I have a number of text boxes that the user fills out: "Date" "Event Title" "Age" "Location" "Details" etc.

2) The user clicks on the "ADD" button to store this event. The "Event Title" is shown in the list box, but I'd like for all of the information that was taken from the user before they clicked on "ADD" to be recalled in another text box.

3) The user can move events up or down in the list box, or remove them completely.

4) When the events have been sorted, the user hits the "GENERATE CODE" button and the html code is generated.

So lets say the list looks like:
- DJ Jim at Katrina Lounge
- DJ Heather at Zanzibar
- DJ Manny at Skybar

When the user clicks on the "DJ Jim" event, the full details that they entered earlier will be shown in a text box to the right of the list box. When they click on the "DJ Heather" event, the text box will reflect the details they entered for the "DJ Heather" event, and so on.

When the user click on "Generate", the program must be able to go through each item in the list box, recall the event details for that item, and plug in the variables for that item into the HTML code template.

The main question is, how can I store the information for each event (Event Title, Date, Location, etct.) while displaying only the Event Title for that even in the list box? If I know how to code this, it will be simple to display this information in the text box and recall the variables to plug into the HTML code

So the structure would be:

CODE:

View 3 Replies

VS 2010 Make A Program Which Access The Internet And Takes The Source Code From The Webpage

Mar 6, 2011

I've been trying to make a program which access the internet and takes the source code from the webpage. I've copied this code from the internet:

[Code]...

View 2 Replies

Socket Programming And Telnet Class For .NET To Simplify The Sending And Receiving Of Data?

Sep 28, 2009

I'm writing a GUI-based app in VB.net that talks to a LambdaMOO server via telnet, sends commands to display the object hierarchy, then parses the output and creates a visual representation of the object hierarchy.So my question is: is there some kind of "telnet client" class for .NET to simplify the sending and receiving of data, or do I have to write my own using the socket API?

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved