Speed of sound


i was wondering if someone could help me. I have been working on this project for about 3 hours. This is my first semester in programming and i think i;m falling behind. My project says: Do not accept distances less than 0. Always check for non-numerical data.

Everything i try to check for the non-numerical data does not work!!!!

This is my code so far.

Private Sub BtnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalculate.Click Try Catch ex As IsNumeric() MessageBox.Show("PLease try again and only enter numbers.") End Try If RadAir.Checked = True Then MessageBox.Show("Your time in seconds: " & CStr(FormatNumber(CDec(txtDistance.Text) / 1100)), "Distance Traveled") ElseIf RadWater.Checked = True Then MessageBox.Show("Your time in seconds: " & CStr(FormatNumber(CDec(txtDistance.Text) / 4900)), "Distance Traveled") ElseIf RadSteel.Checked = True Then MessageBox.Show("Your time in seconds: " & CStr(FormatNumber(CDec(txtDistance.Text) / 16400)), "Distance Traveled") End If ' Check the Distance entered: Must be more than 0. If (txtDistance.Text
Posted On: Monday 24th of December 2012 01:17:49 AM Total Views:  2340
View Complete with Replies

RELATED TOPICS OF Visual Basic PROGRAMMING LANGUAGE




Re: Can this be speeded up?

I have the following code where mcolNodeOrder is a collection object and oxmlNodeList is an XML node list. The purpose of the code is to produce a collection that is sorted by date. It works fine until there are more than about 4000 records in the collection at which point it slows down considerably. Can the code be speeded up vb Code: strDateStamp = oxmlNodeList(lngIndex).childNodes(pmDateStamp).Text With mcolNodeOrder If mcolNodeOrder.Count > 0 Then For lngNOIndex = 1 To mcolNodeOrder.Count If strDateStamp < .Item(lngNOIndex) Then ' Add new entry before the one pointed at by lngNOIndex .Add strDateStamp & SEP & lngIndex, _ strDateStamp & _ oxmlNodeList(lngIndex).childNodes(pmFrom).Text & _ oxmlNodeList(lngIndex).childNodes(mintToNode).Text & _ oxmlNodeList(lngIndex).childNodes(pmTitle).Text _ , lngNOIndex Exit For End If Next If lngNOIndex > mcolNodeOrder.Count Then ' The datestamp is greater than any entry in the ' collection, so add it at the end .Add strDateStamp & SEP & lngIndex, _ strDateStamp & _ oxmlNodeList(lngIndex).childNodes(pmFrom).Text & _ oxmlNodeList(lngIndex).childNodes(mintToNode).Text & _ oxmlNodeList(lngIndex).childNodes(pmTitle).Text _ , , lngNOIndex - 1 End If Else ' Add the first one .Add strDateStamp & SEP & lngIndex, _ strDateStamp & _ oxmlNodeList(lngIndex).childNodes(pmFrom).Text & _ oxmlNodeList(lngIndex).childNodes(mintToNode).Text & _ oxmlNodeList(lngIndex).childNodes(pmTitle).Text End If End With Next
VIEWS ON THIS POST

222

Posted on:

Thursday 18th October 2012
View Replies!

When is a GUID not a GUID?

[edited] I want a GUID, and can't seem to make one! My code should convert a string to a GUID; but the resulting GUID is always empty. Here's my code with an actual GUID string thatfails: Private_userGuidAsString="d5774e1e-b3c4-4f2f-9d1e-c2d9e03df61d" Private_gGuidAsGuid _gGuid = New Guid(_userGuid)... Stopping on the next line, I examine _gGuid, and it's Empty. , geosync _gGuid = New Guid(_userGuidStr) i think you have o change that line to : _gGuid = New Guid(_strGuidStr) , I don't get any exceptions either. Just an empty Guid. , Yes , The new Guid will looks empty in debug , but its not ! You can get its value by calling its .ToString() method , dim GuidValue as string= YourGuidInstance.ToString() You can also use the GuidGen tool which generate a guids string for you , to add the tool to vs , go to Tools->Eternal Tools -> Add , for the command value use : C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\guidgen.exe
VIEWS ON THIS POST

246

Posted on:

Friday 2nd November 2012
View Replies!

Highlight does not stay

How do I change the bg color of the selected row for msflexgrid I need to at least highlight the row when the user clicks anywhere within the row, and display the value in a certain column to a textbox. ...
VIEWS ON THIS POST

230

Posted on:

Saturday 10th November 2012
View Replies!

Re: Problem with .AddNew (ADO)

Martin wrote in news:r6c5qv0mit9v6h62m0oqsm99l5lmnb52fc@4ax.com: > I'm using the code shown below to open a standard, MS Access database. > (Using VB6; MSADO15.DLL is referenced) > > Public SQLCN As New ADODB.Connection > Public rsEData As New ADODB.Recordset > > ...
VIEWS ON THIS POST

316

Posted on:

Sunday 11th November 2012
View Replies!

Info with system tray apps

I successfully made a system tray application. When I do shut down the computer, how does the computer can instruct my application to shut down For the moment, if I don't quit my application, system asks to kill an unresponsive ...
VIEWS ON THIS POST

257

Posted on:

Thursday 15th November 2012
View Replies!

Need help with a Combobox

I have a question for people out there, I need the Combobox to change a label caption when the user picks a certain thing from the list. How do I code this. I've tried an If Then statement, but it ...
VIEWS ON THIS POST

227

Posted on:

Tuesday 20th November 2012
View Replies!

Missing Feature RB 2005: Code Spliter

Previous editions of RB included a code spiter. Of course you would never know this by looking at Real Software's sleazy marketing campaign. Instead they hide the fact that this, and other features that have been removed from RB. Have ...
VIEWS ON THIS POST

222

Posted on:

Tuesday 20th November 2012
View Replies!

Need a VB code

I am trying to color the chat columns in different colours according to the person who is sending it.I have useds the gridview to show my chats along with the to_id and from_id field, which are the ids of the people who are chatting. I found this colde in c#, can someone please convert it to vb and customize according to my needs pleasethank you. I want the rows with the same to_id to be of one colour, and rows of same from_id to be of one colour. Please note this chat is between just two people.
VIEWS ON THIS POST

274

Posted on:

Tuesday 20th November 2012
View Replies!

PHP

i want a small project on PHP , I want a supermodel. How about we move this to SuperModels , Well you could make your own blog, guestbook, bb, or your own CRM app. That is the project I have given myself.
VIEWS ON THIS POST

202

Posted on:

Thursday 29th November 2012
View Replies!