There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
@@@ Visual Basic Help @@@


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
dcf-joe's Avatar
Computer Specs
Member with 52 posts.
 
Join Date: Jul 2007
23-Jan-2008, 04:06 PM #1
@@@ Visual Basic Help @@@
I have Visual Basic 2008 Express Edition. I have successfully built a project. Is there some way that I could put my program on a website so that whenever a user accesses the website, the program will run?
HalTrout's Avatar
Computer Specs
Senior Member with 842 posts.
 
Join Date: Mar 2007
Location: Arizona High Country
Experience: Not quite enough
23-Jan-2008, 04:08 PM #2
What does your program do?
dcf-joe's Avatar
Computer Specs
Member with 52 posts.
 
Join Date: Jul 2007
23-Jan-2008, 04:42 PM #3
It is just a temperature converter, that converts Celsius to Fahrenheit and vice versa. Also, why won't VB 2008 let me make this statement:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2 = TextBox1.Text(9 / 5) + 32 & " ° " 'MsgBox("The Temperature Is " & TextBox1.Text * 9 / 5 + 32)
End Sub

It says that TextBox1.Text can't be multiplied or something.
artur02's Avatar
Computer Specs
Member with 91 posts.
 
Join Date: Sep 2007
Location: Hungary
Experience: Advanced
24-Jan-2008, 04:36 AM #4
You have created your program for Windows, so you won't be able to execute it on your site easily. You can't show the window on the web.

But you can show the results of the program. You should rewrite it as a console application and you can execute it from PHP or any other dynamic web language. You can process the output and show it on your site. I think it's much more simple to rewrite these 2 lines directly in PHP.
__________________
Artúr Herczeg
artur02
http://techies.teamlupus.hu
artur02's Avatar
Computer Specs
Member with 91 posts.
 
Join Date: Sep 2007
Location: Hungary
Experience: Advanced
24-Jan-2008, 04:49 AM #5
Here is the correct code for conversion:

Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox2.Text = (TextBox1.Text * (9 / 5) + 32).ToString()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = (TextBox2.Text * 2 - TextBox2.Text * 0.2 + 32).ToString()
    End Sub
End Class
You have to cast integer to string before assigning it to the textbox.
calvin-c's Avatar
Senior Member with 646 posts.
 
Join Date: May 2006
Experience: Advanced
24-Jan-2008, 05:09 PM #6
Not sure that it'll work, but it won't really solve the problem. Problem is that you're trying to multiply/add strings when they should be numeric datatypes, i.e. decimal or single. (Integer won't work as you're using a fraction.)

Cast the Text to numeric, do the math, then cast the result back to string. Something like this:

TextBox2.Text= ((CDec(TextBox1.Text) * 9/5) + 32).ToString & "`" (can't find the degree sign)

Personally I'd do the conversion separately so I could error-trap it, but that's up to you.
Dim TempVal as Decimal

TempVal=CDec(TextBox1.Text)
do the math
or
If Decimal.TryParse(TextBox1.Text, TempVal)=True then
do the math
End If

TextBox2.Text=TempVal.ToString

The advantage of Tryparse is that it doesn't throw a runtime error if the conversion fails-all it does is return False so you handle the error in an Else clause.

Also, check out the generic CType function-it allows converting to any datatype, e.g.
CType(TextBox1.Text,Decimal) or CType(TempVal,String)
__________________
Time is what keeps everything from happening at once.
dcf-joe's Avatar
Computer Specs
Member with 52 posts.
 
Join Date: Jul 2007
25-Jan-2008, 01:18 PM #7
Well, in VB 6.0 all I had to type in was:

Text2 = Text1 * 9 / 5 + 32

And it would work!
calvin-c's Avatar
Senior Member with 646 posts.
 
Join Date: May 2006
Experience: Advanced
25-Jan-2008, 01:39 PM #8
IIRC you said you're working in VB 2008, not VB 6. And technically, what you did in VB 6 was incorrect but MS allowed for sloppy programming in that. They're much more strict in VB.Net (so much so that I consider it an entirely different language).
dcf-joe's Avatar
Computer Specs
Member with 52 posts.
 
Join Date: Jul 2007
25-Jan-2008, 04:36 PM #9
Thank You Artur02, the code worked. However, I need help with something else. In VB 6, you could add frames. I know that in VB 2008, I have to set the FormBorderStyle to none, but then how do I add my own frame? Also, where can I get a Scroller from, that makes text scroll?
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:24 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.