Simple Question! Please Help 
Author Message
 Simple Question! Please Help

I am a relatively new user to VB4 and I am having a very strange problem
that I cannot figure out. I am trying to right a line to a Text box by
using the Text property. The interpretor, however, cannot find the Text
property or the txt object. This does not make much sense and I was
wondering if I am missing one of the settings in Visual Basic or
something. I have listed my code below.

Quote:
>> Vipul

VERSION 4.00
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   5016
   ClientLeft      =   1212
   ClientTop       =   1944
   ClientWidth     =   8148
   Height          =   5400
   Left            =   1164
   LinkTopic       =   "Form1"
   ScaleHeight     =   5016
   ScaleWidth      =   8148
   Top             =   1608
   Width           =   8244
   Begin VB.CommandButton Command1
      Caption         =   "|>"
      Height          =   372
      Index           =   3
      Left            =   4440
      TabIndex        =   20
      Top             =   4080
      Width           =   852
   End
   Begin VB.CommandButton Command1
      Caption         =   ">>"
      Height          =   372
      Index           =   2
      Left            =   3600
      TabIndex        =   19
      Top             =   4080
      Width           =   852
   End
   Begin VB.CommandButton Command1
      Caption         =   "<<"
      Height          =   372
      Index           =   1
      Left            =   2760
      TabIndex        =   18
      Top             =   4080
      Width           =   852
   End
   Begin VB.CommandButton Command1
      Caption         =   "<|"
      Height          =   372
      Index           =   0
      Left            =   1920
      TabIndex        =   17
      Top             =   4080
      Width           =   852
   End
   Begin VB.TextBox txtProfit
      Height          =   492
      Index           =   7
      Left            =   5520
      TabIndex        =   7
      Top             =   2880
      Width           =   1572
   End
   Begin VB.TextBox txtDateSale
      Height          =   492
      Index           =   6
      Left            =   5520
      TabIndex        =   6
      Top             =   1920
      Width           =   1572
   End
   Begin VB.TextBox txtCommisionSale
      Height          =   492
      Index           =   5
      Left            =   5520
      TabIndex        =   5
      Top             =   1200
      Width           =   1572
   End
   Begin VB.TextBox txtPriceSale
      BorderStyle     =   0  'None
      Height          =   492
      Index           =   4
      Left            =   5520
      TabIndex        =   4
      Top             =   360
      Width           =   1572
   End
   Begin VB.TextBox txtDatePurchase
      Height          =   492
      Index           =   3
      Left            =   2040
      TabIndex        =   3
      Top             =   2880
      Width           =   1572
   End
   Begin VB.TextBox txtCommisionPurchase
      Height          =   492
      Index           =   2
      Left            =   2040
      TabIndex        =   2
      Top             =   2040
      Width           =   1572
   End
   Begin VB.TextBox txtPricePurchase
      Height          =   492
      Index           =   1
      Left            =   2040
      TabIndex        =   1
      Top             =   1320
      Width           =   1572
   End
   Begin VB.TextBox txtSt
      Height          =   492
      Index           =   0
      Left            =   2040
      TabIndex        =   0
      Top             =   480
      Width           =   1572
   End
   Begin VB.Label lblDatePurchase
      Caption         =   "Date of Purchase"
      Height          =   372
      Index           =   8
      Left            =   120
      TabIndex        =   16
      Top             =   3000
      Width           =   1212
   End
   Begin VB.Label lblProfit
      Caption         =   "Profit"
      Height          =   372
      Index           =   7
      Left            =   3840
      TabIndex        =   15
      Top             =   3000
      Width           =   1212
   End
   Begin VB.Label lblDateSale
      Caption         =   "Date of Sale"
      Height          =   372
      Index           =   6
      Left            =   3840
      TabIndex        =   14
      Top             =   2040
      Width           =   1212
   End
   Begin VB.Label lblCommisionSale
      Caption         =   "Commision of Sale"
      Height          =   372
      Index           =   5
      Left            =   3840
      TabIndex        =   13
      Top             =   1320
      Width           =   1212
   End
   Begin VB.Label lblPriceSale
      Caption         =   "Price of Sale"
      Height          =   372
      Index           =   4
      Left            =   3840
      TabIndex        =   12
      Top             =   480
      Width           =   1212
   End
   Begin VB.Label Label1
      Height          =   372
      Index           =   3
      Left            =   120
      TabIndex        =   11
      Top             =   3000
      Width           =   1212
   End
   Begin VB.Label lblPriceCommision
      Caption         =   "Commision of Purchase"
      Height          =   372
      Index           =   2
      Left            =   120
      TabIndex        =   10
      Top             =   2160
      Width           =   1212
   End
   Begin VB.Label lblPricePurchase
      Caption         =   "Price of Purchase "
      Height          =   372
      Index           =   1
      Left            =   120
      TabIndex        =   9
      Top             =   1440
      Width           =   1212
   End
   Begin VB.Label lblStockTrade
      Caption         =   "Stock Trade"
      Height          =   372
      Index           =   0
      Left            =   120
      TabIndex        =   8
      Top             =   480
      Width           =   1212
   End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Dim WS As Workspace
Dim RS As Recordset
Dim DB As Database

Private Sub Command2_Click()

End Sub

Private Sub Form_Load()

Set WS = DBEngine.Workspaces(0)
Set DB = WS.OpenDatabase("C:\MYVB\ORGANIZER\STOCKS.MDB")
Set RS = DB.OpenRecordset("Trades 1996", dbOpenDynaset)
'THIS IS THE LINE CRASHING
' THE INTERPRETOR SAYS THAT IT CANNOT FIND THE METHOD OR THE
' THE OBJECT. ??????????
txtSt.Text = RS![Option]

End Sub

Form=frmStocks.Frm
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0; COMDLG32.OCX
Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX
Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0; RICHTX32.OCX
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0; COMCTL32.OCX
Object={FAEEE763-117E-101B-8933-08002B2F4F5A}#1.1#0; DBLIST32.OCX
Object={00028C01-0000-0000-0000-000000000046}#1.0#0; DBGRID32.OCX
Object={F6125AB1-8AB1-11CE-A77F-08002B2F4E98}#1.0#0; MSRDC32.OCX
Reference=*\G{BEF6E001-A874-101A-8BBA-00AA00300CAB}#2.0#0#C:\WINDOWS\SYSTEM\OLEPRO32.DLL#Standard OLE Types
Reference=*\G{EE008642-64A8-11CE-920F-08002B369A33}#1.0#0#C:\WINDOWS\SYSTEM\MSRDO32.DLL#Microsoft Remote Data Object 1.0
Reference=*\G{00025E01-0000-0000-C000-000000000046}#3.0#0#C:\PROGRAM
FILES\COMMON FILES\MICROSOFT SHARED\DAO\DAO3032.DLL#Microsoft DAO 3.0
Object Library
Reference=*\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#1.0#0#C:\WINDOWS\SYSTEM\MSO5ENU.DLL#Microsoft Office 95 Object Library
Reference=*\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#D:\MSOFFICE\OFFICE\MSO97.DLL#Microsoft Office 8.0 Object Library
Reference=*\G{0002E157-0000-0000-C000-000000000046}#5.0#0#C:\PROGRAM
FILES\COMMON FILES\MICROSOFT SHARED\VBA\VBEEXT1.OLB#Microsoft Visual
Basic for Applications Extensibility
Object={648A5603-2C6E-101B-82B6-000000000014}#1.1#0; MSCOMM32.OCX
Object={FB079AE0-551B-11CF-A0BE-00AA0062BE57}#1.0#0; MSCONDES.DLL
ProjWinSize=276,308,240,256
ProjWinShow=0
IconForm="Form1"
Name="Project1"
HelpContextID="0"
StartMode=0
VersionCompatible32="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionC



Thu, 21 Oct 1999 03:00:00 GMT  
 Simple Question! Please Help

txtSt's Index is set to 0 so VB thinks it is a control array. The array
itself does not have a text property.
Solution:
either set txtSt.Index = Null (just hit delete in the property window or
reference it as txtSt(0)
~Ray
_____________________________________________________________________

                            Endless Knot Enterprises
                      Custom Computer Solution Developers
                       http://www.xtalwind.net/~endlessknot
_____________________________________________________________________



Quote:
> I am a relatively new user to VB4 and I am having a very strange problem
> that I cannot figure out. I am trying to right a line to a Text box by
> using the Text property. The interpretor, however, cannot find the Text
> property or the txt object. This does not make much sense and I was
> wondering if I am missing one of the settings in Visual Basic or
> something. I have listed my code below.

> >> Vipul

<clip>


Fri, 22 Oct 1999 03:00:00 GMT  
 Simple Question! Please Help

Your txtSt is a control array and needs to be referenced like so:
txtSt(0).text or delete the index property of the control.



Sat, 23 Oct 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. SIMPLE SIMPLE ListView Question. Please help

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. SIMPLE QUESTION, please SIMPLE ANSWER

4. Simple question, please help!

5. Simple question, Please Help!!! :)))

6. Please Help with a simple question

7. Simple question...please help

8. Simple question..help please

9. Please Help with a simple question

10. Please Help With Simple Question

11. PLEASE HELP: simple question

12. A simple question - please help

 

 
Powered by phpBB® Forum Software