Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2006, 03:06 PM
Registered User
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default TextBox - formattering input after event

Hey

I am used to VB6, but VB05 seems to puzzle me a bit. I am trying to a get a textbox to format its input after an event:

Event....
Dim Item1,Item2,etc... As Decimal
Dim Style1 As String = "0.#"
Dim Style2 As String = "0.###"
Select Case...
    Case...
End Select...

'Now values has to be returned'
TextBox1.Text = TextBox1.Text.ToString(Style1) - However got it work using: VB6.Format(CDec(TextBox1.Text), "0.#") - used to be: Text1(0).Text = Format(Expression:=CCur(Text1(0).Text), Format:="0.#")
TextBox5.Text = MethanolAmount.ToString(Style2) "this works"

The problem is that I wanted TextBox1 to perform as TextBox5, so I tried attaching a Style1 with no luck. Got the following error - {"An object of type 'System.String' can not convert to type 'System.IFormatProvider'."} As I wrote before, I got it to work by using VB6.Format. However, it seems as a cheap solution. It most be possible to do it the "VB05 way".
I most admit that VB05 is powerful compared to VB6, but it seems as the easiest things as become difficult. I really miss the simple option of making an index of controls - ex. Public Sub Text1_GotFocus(Index As Integer) However, I figured that out using Wrox VB2005 Programmer’s reference – a marvellous book






Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox Event davewoods Visual Basic 2005 Basics 3 October 10th, 2008 12:56 PM
Moving input from textbox to field stealthdevil Access VBA 7 May 24th, 2006 11:33 AM
Add new record to databased based on textbox input CarolMorgan Classic ASP Professional 2 January 10th, 2005 01:45 PM
Validation of TextBox Input bpgadhia ASP.NET 1.0 and 1.1 Professional 1 March 16th, 2004 05:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.