Forms :: Shorten This Code Using A Wildcard?

Mar 8, 2010

I am making a project for school with visual basic and its a mcdonalds ordering system.There are 50+ buttons which you can press to remove an item and my code works fine. only problem is it is waaaaayyyy to long and can be shortened with a wildcard. Does anyone know what a good way to put a wildcard in the following code would be:

Private Sub btnsmallfries_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsmallfries.Click
If Label2.Text = "Buy Mode" Then

[code].....

View 5 Replies


ADVERTISEMENT

Is There Any Way That Can Shorten Code

Dec 20, 2011

This is the code that i would like shortenning, it uses a progress bar and a label that counts down with it: I'm using the language of VB..[code]

View 1 Replies

How To Shorten The Code

Mar 2, 2009

Is there a way to shorten the code below?

Like example:
from weeklbl1 to weeklbl4
location = new point ()

[code].....

View 2 Replies

VS 2005 To Shorten This Line Of Code?

Mar 31, 2010

If xtn <> ".bmp" And xtn <> ".jpg" And xtn <> ".jpeg" And xtn <> ".png" And xtn <> ".gif" Then

I am getting a feel that there should an better way to do this

View 4 Replies

VS 2010 Unable To Shorten Code?

Jul 13, 2011

I want a textbox to be checked for specific characters. I can use: with textbox1.text If .contains("a") or .contains("b") or .contains("c")...etc... then...

View 7 Replies

VS 2008 Shorten Code Adding Items Listview?

Feb 3, 2010

I have some code which addes values into the items and subitems, which works fine.

vb.net
Case "Aa en Hunze"
Dim Lvi00 As New ListViewItem(New String() {"naam", "blabla"})
Dim Lvi01 As New ListViewItem(New String() {"adres", "blabla"})
Dim Lvi02 As New ListViewItem(New String() {"postc/plaats", "blabla"})

[Code]...

View 4 Replies

Shorten This Code That Writes Current Year And Past Years?

May 26, 2011

<%
Dim i As Integer
Dim isNow = DatePart("yyyy", Now)

[code].....

View 1 Replies

String.Replace With Wildcard (and Use Whatever "wildcard" Is)?

Aug 31, 2010

What I want to do is to replace lets say ##test## with Something(test)..I know that I can find ##test## by: (Though don't know whether there's a smarter way)

System.Text.RegularExpressions.Regex.Replace(str, "##Test.*##", "Output")

So basically the problem is to get what the wildcard (.*) is, since thats really what I need to know..

View 2 Replies

.net - Vb .net Shorten An If Statement

Sep 29, 2011

I'm trying to make this cleaner... I know there's lots of shortcuts for If statements, but I don't know what's best.

If item.RecurrenceId > 0 Then
xmlTextWriter.WriteElementString("recordtype", "2")
ElseIf IsNothing(item.OngoingEndDate) = False Then
xmlTextWriter.WriteElementString("recordtype", "1")
Else
xmlTextWriter.WriteElementString("recordtype", "0")
End If

View 5 Replies

.net - Shorten Array Declaration?

Sep 15, 2010

Question: How to shorten this array creation ? I need to create an array of type ReportingService2005_WebService.Property with one property.

Something like:

Dim PropertyArray() as new ReportingService2005_WebService.Property(1)

I have to do this:

Dim PropertyArray As ReportingService2005_WebService.Property() = New ReportingService2005_WebService.Property(0) {}
PropertyArray(0) = New ReportingService2005_WebService.Property

[Code].....

View 1 Replies

VS 2008 How To Shorten Long Value

May 4, 2012

Dim num as integer = 1.60285253
Msgbox(shorted num??)

I want msgbox to show only shorted version of that number, so It should give 1.06

And is is possible to make it round third number to higer? If I want limit it to 2 numbers only, it should show 1.06 as 1.1, but if number was 1.04 it shows shortened number as 1.0.

View 3 Replies

Any Algorithm To Shorten Very Large Integer?

Dec 8, 2010

I have a function which generates a very large Integer (I do this by using Biginteger from vjslib.dll and I am able to operate all kind of arithmetic operators on such a biginteger.) But, My goal is to shorten this big integer into a small integer. Is there any algorithm? or a mathematical Formula which I can use to represent it in a small integer and use some reverse formula to get the original Big integer?

The big integer my function creates goes like this:
98761210112313489375987956157462364864823458794572 34573485683465868234568613123749081377932457923457 93475897836587236458678234568234658362458762347895 68932456892346578636123846715376123475745723645666 38247687346128346812364812364816341384612384678345 76341236412783461278346781236481263489126348971238 41134681273467812364789

I do not want to represent my bigInteger in a higher base as it will not be possible to do conversion into higher bases with such a large integer.

View 2 Replies

Possible To Shorten Length Of Any Of String In A Way In Which It Also Can Be Reversed?

Jan 1, 2011

Im working a lot with normal strings and during my development process strings with lengts of 10.000+ characters are being processes which makes it a my application run slower.Is it possible to shorten the length of any of string, in a way in which it also can be reversed?

View 16 Replies

Replace / Shorten Word In RichTextBox

Feb 6, 2011

I am trying to use this code to shorten words like Hello to Hi, and Whats up to sup in a rich text box.
If Value.Contains("Hello") Then
Value.Replace("Hello", "Hi")
End If
End Sub

View 4 Replies

C# - Shorten This If... Else... Statement To Check The State Of A Date?

Apr 2, 2010

I am a C# programmer but dabbling in VB.Net because everybody else in my team uses it. In the interests of professional development I would like to shrink the following If... Else... statement.

If cmd.Parameters("@whenUpdated").Equals(DBNull.Value) Then
item.WhenUpdated = Nothing
Else
item.WhenUpdated = cmd.Parameters("@whenUpdated").Value
End If

View 5 Replies

Shorten Selected Value In ComboBox DropDown List For Display

Feb 21, 2010

I have a combo box that has a drop down list with long values in the drop down
Ex:

LB - Pounds
GR - Grams

When the user selects on of the values I want to just show the Abreviaqtions and not the descriptions. So when the drop down is shown it shows

LB - Pounds
GR - Grams

When the user selects "GR - Grams" from the drop down list "GR" is the only this shown in the combobox. I've tried TextChange,SelectedIndexChange and SelectedValueChange but I can't get them to work.

View 1 Replies

VS 2008 Adding A Method To All Forms Existing Forms Without Changing Their Code?

Jul 28, 2009

just wondering if it is possible to add a method to all forms in my project without having to do it on one form and Inherit all my other forms from that one

View 3 Replies

Way To Use Wildcard

May 8, 2010

I have a datagridview on a form.

I have a text box and when the text is changed in the text box, i want it to search the datagridview for any matching values.[code]...

View 3 Replies

.net - Extracting The Wildcard Value?

Jul 20, 2011

I've been having problems extracting the value of a Regex in a String. I have a string with several regex expressions and I need to get the value of each expression's match. The thing is though, it's not returning the last match correctly. For example:

Regex Pattern: I play (S+.*?) and (S+.*?)

String: I play the guitar and the bass The program is returning the value of the first expression as "the guitar" but it's returning the value of the second expression as "the" instead of "the bass".

View 3 Replies

Unable To Shorten It Before By Making A Generic Function To Create The Radio Buttons?

Oct 20, 2009

I'm sort of repeating the same steps. There's got to be a way to shorten it.I was able to shorten it before by making a generic function to create the radio buttons.This is the before the rewrite

Public Sub LoadPanels(ByVal tblClient As DataTable)
Dim count As Integer = 20
Dim tooltip As New ToolTip
Dim countName As Integer = 0

[Code]...

View 4 Replies

Forms :: TextChanged Code And Button Click Code Not Working?

Jul 2, 2009

I have made an application in VB.NET.The Button click codes are working fine. I have made a small modification in the code. I have commented the line 'Me.Close'But still my form gets closed. I think the application is executing from elsewhere.

View 8 Replies

Add A Wildcard Parameter To Query?

Aug 11, 2009

How do I add a wildcard parameter to my query. Im using a mysql database. The following doesn't work:

Dim occCmd As New MySqlCommand("SELECT occupationid,descr FROM occupations WHERE lcase(descr) like '?descr%';", con)
occCmd.Parameters.AddWithValue("?descr", prefixText)

View 3 Replies

Bindingsource Find Using A Wildcard?

Feb 5, 2009

I'm trying to use the bindingsource.find method to match a datarow column with a user entered text. I know that using BindingSource1.find("columnName", searchString) will work when the user enters the exact string. What I would like to know is how to find a row that is close to the string using a wildcard search... a good example I guess is:dim searchString as string = textbox1.text 'lets say the user enter "se"dim index as integer = myBindingSource.find("columnName", searchString) 'I would like to find the firs record that starts with "se"I can achieve the idea using the bindingsource.filter method but this will interfere with other parts of my application if the bindingsource is changed.

View 6 Replies

How To Use Wildcard For Attachement File Name

Jun 22, 2010

How can I use wildcard/s for the attachment filename. Part of the filename changes but the characters 8 and 9 (counting from the left to right) always present and always either LK or KL. Currently files are PDF type, thus with extension PDF but might be different in the future (this is not important now).

Here it is: Dim oAttch As Net.Mail.Attachment = New Net.Mail.Attachment("C: est102309LKO.pdf")

View 9 Replies

Pass Wildcard As Interger?

May 18, 2009

As you can see in the picture I send my wildcard parameters to my query if the "textbox" does'nt have any content. But when the query require INT, and not STRING, I don't really know what to do.Is there another kind of wildcard when it's INT?

View 19 Replies

Search For Filename With Wildcard?

Jan 13, 2011

searching a directory for a file, and if it doesn't find that file to search again for a similar file and notify the user that a image does exist but for a different revision.

Sub GVC_Photo()
Dim photostr As String = "R:itemphotosp_"
Dim photostr2 As String = "R:itemphotosp_"
Dim photostr3 As String = "R:itemphotosp_"
Dim photostr4 As String = "R:itemphotosp_"

[code]....

This code snippet is used in a program called SyteLine, so some of it may be unfamiliar, but its .net based. The item and revision are fed through from the form, so when the string gets built it might look something like this "R:itemphotosp_22554_B_01.jpg" with "22554" being the item, "B" being the revision, and "01" being the image number. So what I want is if it cannot find a file name with revision B in it, to search for a filename with any revision it it "R:itemphotosp_22554_*_01.jpg", if it finds one to display a message that a non-current photo exists, and if it can't find that, to display a message saying there is no photo.

View 2 Replies

VS 2010 Can't Have Wildcard In Middle?

May 17, 2011

I'm trying to query a Datable. I can do this just fine: [code] gives me an error: "Error in Like operator: the string pattern 'a*e' is invalid.". Why can't I have the wildcard in the middle? I want to find values that start with something specific & end with something specific & I dont care what's in between.

View 2 Replies

Forms :: Write Code With Multiple Forms?

Apr 17, 2009

I am trying to write code with multiple forms. The first screen is splash screen then is supposed to close and have a calculations screen. In the timer of the splash screen I wrote the following code

Option Explicit On
Option Strict On
Public Class uiHinsbrookSplashScreen

[code]....

This opens the second screen, but when I Hit Exit on the Second Screen The first screen is still open. What do I need to do next?

View 2 Replies

.net - Rename Wildcard File In VB Script?

Mar 27, 2012

New user here. I've been searching high and low for what I would think is a relatively simple task. I want to rename a file with a wildcard (i.e. FileNamexxx.xls) within a Visual Basic Script. I'll be running this script within Visual Studio.

I will only have 1 file in this folder, so I do not believe a loop is necessary.
Actual FileName is "CellModelHistory1251234.xls"

Imports System
Imports System.IO
Imports System.Text
Imports System.Windows.Forms

[Code]...

View 2 Replies

DB/Reporting :: Rename A Table In SQL Using A WildCard?

Sep 24, 2008

I'm importing a .csv file into my SQL Server (2005) using SSIS on a schedule, after its imported I would like to change the name of the file. The name of the imported file is always different as its coming from an external source.Is there anyway of changing the table name?

I've looked at using the stored procedure sp_rename, i.e.

Code:
USE TESTDATABASE1
GO
EXEC sp_rename 'dbo.SalesTerr5673A1889', 'Values';
GO

What I would like to use is a wildcard?

View 1 Replies







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