VS 2008 - Use Regex Or An Array To Display Some Output From An Arithmetic Input?

Sep 19, 2009

I've to make a program that reads an arithmetical sentence from a textbox, e.g 12.3*34+4*5-3 and then on another textbox identify and display what is the content of the first textbox, for example taking the last ex:

If I have this input:

12.3*34+4*5-3

The output should look like this:

<number>12.3
<operator> *
<number> 34
<operator> +

[code].....

This program should only read this operators like (+,-,*,/).I'm have in mind 2 ways of doing it, one with regex and the other taking the first sentence, put it on an array, then trim it, and somehow get the values of the array and identify if it is a number or a decimal number and if it's an operator and then display it.

The difficult part or the part that i can't conceptualize is how to implement it with regex (it should be easier with a regex format than storing it on a array).I write a bit of code, I used an array to store and then to print the numbers and I used the split function to separate the math operator, but I dunno how to print the operators and the tags.

vb
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Sentencia As String = TextBox1.Text Dim i As Integer Dim arryTextBox() As String TextBox2.Clear() arryTextBox = Sentencia.Split("+", "-", "*", "/") For i = 0 To UBound(arryTextBox) Dim Array As String = arryTextBox(i)

[code].....

Btw, I also have the code to validate the input on the textbox ::wink::

View 2 Replies


ADVERTISEMENT

VS 2008 Input A Value To Output Another?

Oct 19, 2010

In my programming class, we have been set a task in which a user inputs 8 numbers, and those 8 numbers will be split into groups of 4 (therefore having 4 lots of two digit numbers). These 2 digit numbers will then translate to a specific time, day, place and city.

For example, this table below is what we have been given for city. (there are separate tables for time, day, place with different 2 digit numbers)

(Excuse the formatting)
City Code
London 11
Paris 37

[Code]...

For example, if a use inputs 11995467 I would want that to output London (being the number 11), [a PLACE = 99], [a DAY = 54], [a TIME= 67]

Bearing in mind I am a newbie, and my knowledge of VB is minimal. How would I go about doing this. It's suggested we use MOD and integer division, but I don't see how it can work.

View 5 Replies

VS 2008 Redirect Input And Output Of Command Prompt

Nov 27, 2009

Every time I try and redirect input and output of command prompt I have a problem. The debugger itself crashes! Something must really be wrong. What is a good way to launch CMD and send commands to it, receive output.

View 1 Replies

Input Text Display Output Text?

May 4, 2011

Basically, I want to have a text box that will display text associated with the text input.

For Example:

input : 512
output : TEXAS

or

input : 659
output : ALABAMA

I have heard that it is possible to do this, and I would like to find out a way to. Even if I need a separate text file with the arrays, I would like to get this to work.

View 10 Replies

Inout Box: Input A Percentage To Increase Prices In An Array And Display In The List Box

Apr 23, 2011

This is what I have so far, I know it should be simple as hell, but I'm having a huge brainfart at the moment. Im going to continue messing with it though. Im trying to make it so I can input a number for a percentage, multiply that with my current array prices, and display the total in the listbox. I have a few theories on why it isnt working but cant pinpoint which one to use, I'm at a basic level to this and still learning the process. Im also pretty sure I dont have everything I need on here yet.

[Code]...

View 10 Replies

How To Display Arithmetic Decimal

Oct 29, 2009

I am creating a final grade calculator for my Visual Basic Class...It takes 4 grade text box entries, adds them together and then divides by 4 to get the average grade...The average grade result needs to display one number past the decimal. (Ex: 89.2) I cant seem to be able to get the average grade result to display the 1 digit to the right of the decimal...

Private Sub Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calculate.Click
' This event handler is executed when the user clicks the
' Calculate button. It calculates and displays the average

[code]....

View 6 Replies

Array Of Arithmetic Operators?

May 2, 2011

I want to place the arithmetic operators in an array so I can randomly select one at a time. I am not sure how to declare and initialize them so that I can use them in an equation.

View 11 Replies

Basic Addition Calculator - Display Entire Arithmetic Solution Including Answer

Dec 22, 2008

I am using Visual Studios 2008. I'm trying to make a basic addition calculator. It consists of 2 input text boxes, 1 output box and one button. Below is the code I have which works, however, instead of just displaying the answer, I want it to display the entire arithmetic problem including the answer. For example. Instead of just giving me the answer of "6" in the output text box, I want it to say "3 + 3 = 6".

Here is the code I have so far.
Public Class Form1
Private Sub btnAddition_Click_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddition.Click
Dim num1, num2, sum As Double
[Code] .....

View 4 Replies

Stop An Array Value From Changing When A Random Output Is Generated Using VB 2008?

Nov 28, 2009

I am generating an array of random numbers for for a class project (simple yahtzee game)I am comparing the output of the array and displaying a picture of each matching dice in a picture box.I would like to use check boxes to select a position of the array so it cannot be changed until the check boxes are clearedWhen the check box is checked, the value of the position in the array should not change.

View 6 Replies

VS 2008 Input Box Data To An Array

Mar 22, 2009

im creating a simple program where the user inputs there own numbers in a textbox and the program works out the total and average and produces a bar chart.I have done the hard part of creating the bar chart, but i am stuck on using the numbers in the text box from the array.[code]

View 5 Replies

Converting Arithmetic Expression With Operators In A String To An Operable Arithmetic Expression

Feb 5, 2010

I must convert string data from a CNC that is arithmetic expression to a number that I can use in a VB application that I wrote. The following is what I get out of the cnc. [18722*65536+19377]/67108864. I need to evaluate this expression in my VB ap. The format of the string is not always the same as what I have illustrated.

View 2 Replies

Regex LookAround : Match A Certain Input?

Sep 15, 2010

I'm having a problem trying to match a certain input.The rules of the input is the following: Whole numbers are entered into a text box and they must be separated by a space. There can be anywhere from 1 to infinite numbers. The last character entered must be a digit (no trailing space). Every space delimite must be only 1 space. I'd prefer to handle this all in regex.

My regex:
(?=\d$)^(\d+[\x20]?)+$
([\x20] is a space character)

It doesn't like the lookahead before the carot nor does it like a lookbehind after the $. If I leave the lookahead out, ^(\d+[\x20]?)+$ will match as needed for everything except to ensure the last character entered is a digit.

View 7 Replies

Clearing Output When Input Changes?

Jun 2, 2009

I created a simple calculator. I just graduated with my Bachelors in Software engineerin in March of 2009. I am tryig to get a better understanding of VB.Net. I created a simple practice calculator and would like to know what code needs to be added in the code to clear the output when the user changes the input without adding a clear button as I know how to clear the input and output using a clear button, y working code is pasted below.

[code]
Public Class Calculator 'Form click event handler
Private Sub Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

Download file asynchronous using sockets

View 2 Replies

Do A Calculation Where-in Output Is Different Depending On What Input Is

Jul 28, 2009

I'm trying to do a calculation where-in the output is different depending on what the input is. [code] I have these repeated using >=50 >=60 etc. but when I go to run the program I get this: [code] basically I need to know how to create a cut off point for the grading system. <= doesnt seem to work.

View 4 Replies

Input Output Error Stream?

Oct 30, 2011

Applications in the .NET Framework can use the System.Console class to read characters from
and write characters to the console. Data from the console is read from the standard input stream,data to the console is written to the standard output stream, and error data to the console iswritten to the standard error output stream. These streams are automatically associated withthe console when the application starts and are presented as the In, Out, and Error properties, respectively.I am working with redirects and I am solving small problems one at a time. So far so good, but I lost track of the big picture here. Can someone please clarify something for me.

View 1 Replies

Passing Two Input And One Output Parameters

Oct 7, 2010

I have a stored procedure with two input and one output parameters. I need to execute the stored procedure from VB 2008 code passing it two parameters and returning the output parameter. How might I go about doing this? I don't have how to do this. Newbie here.

View 1 Replies

Regex - Match Words Driven From A Database In A String Input

Jun 27, 2012

I am trying to match words driven from a database in a string input using VB .NET
The syntax I am using is so simple:

[Code]...

View 1 Replies

Regex - Regular Expression To Check Input On Multiline Textbox?

Mar 15, 2011

regex - regular expression to check input on multiline textbox

View 5 Replies

Open A File For Output Or Input Or Even Append ?

Jul 6, 2011

find a way to check if a file exist before opening it or creating it.I know how to open a file for output or input or even append which is what is going to do assuming it exist already.

'all this is inside a button which will open the file upon pressed
'to populate a
'combo box drop down list[code]....

View 3 Replies

Collection Input/output Text File?

Nov 30, 2011

Normal
0
false

[Code]....

This question has been most likely been asked a number of times, but really hitting a brick wall regarding this.

The issue is that at the moment, I have to create a database using text files on VB.

So far I have managed to get the code working to add new customer and browse added records, but stuck on how to output/input back and fore to a text file, to store information, and after this input/output the text file to a DB ( Not worried about this at the moment)

Public Class Customer
Dim CmrColl As New Collection 'Create the new collection. Think of this as an array of objects.
Dim itemCount As Integer = 0 'A variable to help us scroll through the objects later.

[Code].....

View 3 Replies

Communications :: Input / Output Control Board?

May 30, 2010

We learned How to assemble an input/output control board that would connect to your serial port. We were able to use out statements (back in the old gwbasic) to send output signals to the parallel port to turn on/off different outputs. The board had connections where you could connect lights, relays, etc, and had connections where you could attach switches and sensors.

I have been looking for something simple that I can manipulate in my programs. I already have an ActiveHome X10 interface which includes an activex for receiving and sending x10 signals (home automation, turning lights on/off, etc.). I want something that I can straight out connect relays to, and sensors as well. I don't want something that connects to the serial port since that is already being used up, the parallel port would work fine, or even better usb.

View 6 Replies

Finding String Encryption With Given Input And Output?

Jan 17, 2010

I have an input and an output, but i would like to know what how to calculate/find the string encryption in between.

Input: 22ac24c481690dd5d90973c6697624ec
String: ??? Unknown
Output: cc28641637656a42e092b61d3e67af0d

[URL]

View 6 Replies

Input And Output Command Line Arguements?

Sep 11, 2009

I have 2 VB programs that I would like to communicate with each other, but I want them to be separate EXEs. Anyway, the easiest way I figured would be for me to call the one program from the other and then return a result. How do I get this result into another program?

Here is how I want it to work:

1. Start System Information Program (easy)

2. Call a video test program, and send a couple arguments (see below)

3. Receive arguments from the video test (I do not know how to do this, I do not know how to send from the video test or receive from the system information)

View 5 Replies

Input And Output To A Text File Using Console Application

Dec 30, 2011

need an example of a console application that would allow you to input data to and retrieve data from a text file on disk.

View 2 Replies

VS 2008 - Arithmetic Operation Resulted In Overflow

Sep 28, 2010

For iLoop As Integer = 0 To length
Dim byte1 As Byte = Fs1.ReadByte()
Dim byte2 As Byte = Fs2.ReadByte()
Dim offset As Byte = Fs1.Position()
If byte1 <> byte2 Then
OffSetFS.WriteByte(offset)
OutPutFS.WriteByte(byte2)
End If
Next
Arithmetic operation resulted in an overflow.

View 16 Replies

VS 2008 Arithmetic Operation Resulted In An Overflow?

Sep 28, 2010

Dim f1 As String = "File1Path"
Dim f2 As String = "File2Path"
Dim Fs1 As New FileStream(f1, FileMode.Open)
Dim Fs2 As New FileStream(f2, FileMode.Open)
Dim f1length As Integer = Fs1.Length - 1
Dim f2length As Integer = Fs2.Length - 1

[Code]...

Application.StartupPath & "PatchData.dat": PatchData.dat isn't created yet, but my program makes PatchData.dat, and PatchData.dat is ~8KB when my program gives me this error.

View 5 Replies

VS 2008 Produce An Arithmetic Overflow Statement?

Jun 10, 2009

why this code would produce an Arithmetic overflow statement? I don't see any reasons why, and the error produces no line number

Try
Me.CampaignsTableAdapter.Fill(Me.EmailPromoTimeSaverDataSet.Campaigns)
mainFormURLTextBox.Text = "http://google.com"

[Code].....

View 17 Replies

Catch The Input And Output Variable To A Textbox1 For Sending And A Textbox2?

Feb 1, 2010

I am using vb2008.net express, I test vs2005term it work, can any tell me what is the input variable and output variable of this terminal? how to catch the input and output variable to a textbox1 for sending and a textbox2 for receiving when I press send button? is that possible? I attach the example of my question this is a a good source, but it is not relate to my problem: [url]...

View 1 Replies

Compare Two Input Files And Extract The Duplicates To One Output File

Dec 31, 2009

so here is my scenario. I have two input files... both are plain text files. File1 has customer name, customer address and invoice number. File2 has customer name, customer address, invoice number AND a keyline. File1 will only contain some of the records in File2, and it will change daily. I need to be able to compare File1 against File2 and output one file (preferably an Excel spreadsheet) with the info from File1 and the keyline from File2, that matches the duplicated info. I know the basics to get it to work, but I'm not sure what would be the easiest way of doing this... File2 can have up to 100,000 records per day. I'd only need to run it once a day though.

View 6 Replies

Write A Code That Will Let Me Input 2 Alphabets And They Will Output In Alphabetical Order?

Sep 4, 2009

I am writing a program which was pretty easier until I got to a certain part. I need to write a code that will let me input 2 alphabets and they will output in alphabetical order

Ex:
Please Enter alphabet 1: b
Please Enter alphabet 2: a

[code]....

View 3 Replies







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