Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
| Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 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 January 15th, 2004, 12:35 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , Kent, United Kingdom.
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing forms properties at run time

Hi

I have a form that I want to re-use at run time, so I need to be able to change certain properties, such as the text that appears at the top of the page. How do I do this at run time?

Thanks in Advance

Louisa

 
Old January 15th, 2004, 12:48 PM
Authorized User
 
Join Date: Dec 2003
Location: Middletown, CT, USA.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is the form used for, more specifically, what criteria will trigger a change?

John

 
Old January 15th, 2004, 12:53 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at the code that Visual Studio has generated for you. You'll see that it just sets a bunch of properties for the form in code. You'll see stuff like this for example:
Code:
        Me.Button1.Text = "This is button text"
Me.Text = "This is the Form's Caption"
This code sets the text for a button on the form, and for the caption on the form.

You can do the exact same thing at run-time.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 15th, 2004, 12:55 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , Kent, United Kingdom.
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just have two reports that are very similar, the user enters two dates and they print off different data from the recordset depending upon which report they are running. The reports have different titles so I wanted the different titles to appear in the text bar at the top of the form. A boolean value is passed to the load even so it knows which report it is running and a button event runs the report.

Louisa



 
Old January 15th, 2004, 01:01 PM
Authorized User
 
Join Date: Dec 2003
Location: Middletown, CT, USA.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I understand you correctly
write a conditional statement setting the forms title bar by clicking on form properties and writing a routing in the forms on_load() event. This should do the trick

Let me know

John

 
Old January 15th, 2004, 01:07 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , Kent, United Kingdom.
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you both it is working perfectly.

Louisa





Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing image at run time Swati Chari Beginning VB 6 0 March 12th, 2008 06:02 AM
changing data source location at run time sandeepjakhotya Crystal Reports 0 April 16th, 2006 05:40 AM
Set AdoDc properties at run time Psionman Pro VB Databases 2 November 10th, 2004 10:07 AM
Updating controls on forms at run-time chipset VB How-To 5 September 25th, 2004 05:25 AM
Changing DataBase at run time siwanski BOOK: Professional Crystal Reports for VS.NET 1 September 17th, 2004 03:24 AM





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