gettingstarted
[Top] [All Lists]

RE: views on reusable code?

To: "Getting Started" <gettingstarted at lists dot realsoftware dot com>
Subject: RE: views on reusable code?
From: "Dixon, Tom" <dixont at Jostens dot com>
Date: Sat, 30 Apr 2005 11:16:09 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
Thread-index: AcVNm7zlQq5kY1tNRE2MaN78IWKuPwAABkCg
Thread-topic: views on reusable code?
I am sure you can simplify your code with one or more methods to handle
the events if they really are basically the same other than the names.
Try a sample project first. Single window, one tab panel with one edit
field on each Tab to get the hang of this.

Create two String properties for the window
strng1 As String
strng2 As String

Create a method in the window.

Method Name: populateTabPanel
Parameters:  tabnum As Integer

Put this code in the method
  If tabnum = 0 Then
    EditField1.Text = strng1
  ElseIf tabnum = 1 Then
    EditField2.Text = strng2
  End If

Put this code in the window open event 
  strng1 = "String 1"
  strng2 = "String 2"
  TabPanel1.Value = 0

Put this code in the TabPanel1 Change event
  Dim i As Integer
  i = Me.Value
  populateTabPanel(i)

HTH

Tom


-----Original Message-----
From: gettingstarted-bounces at lists dot realsoftware dot com
[mailto:gettingstarted-bounces at lists dot realsoftware dot com] On Behalf Of
Eirik Karlsen
Sent: Saturday, April 30, 2005 10:46 AM
To: Getting Started
Subject: Re: views on reusable code?

Well....how about those windows and the code in all the control's
events?


"Dixon, Tom" wrote:

> Why not create a method with the same code written once and pass the 
> appropriate variable to it.
>

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>