473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Setting Object Variable

2
Hello Guys,

I'm trying to dynamically create forms and add controls to them. I'm specifically having a problem with establishing a data source for my textbox. I am able to add a remote data control called dSlider that appears to function properly. The textbox txtID also properly positions itself as directed. But I can't dynamically get it to bind to my coded data controller as a dataSource. VB6 tells me that the "object variable or with block is not set." I've tried setting the object variable but really just don't know what I'm doing. Can someone get me out of this rut, please!!?

The pertinent programming is attached. I get hung up on txtID.dataSource = dSlider.
Thanks for any advice.

MainDbs = "C:\MyFiles\My Documents\V_Basic\Substation1.mdb"
Set dbs = DBEngine(0).OpenDatabase(MainDbs)
Set rs = dbs.OpenRecordset("General")

Set dSlider = gFormArray(NumForms).Controls.Add("VB.data", "dSlider", gFormArray(NumForms))
Set dSlider.Recordset = rs ' Set Data1.recordset

' Activate a textbox on the ArrayForm and bind it:
Set txtID = gFormArray(NumForms).Controls.Add("VB.TextBox", "Text1", gFormArray(NumForms))
With txtID
.Visible = True
.Top = 1440: .Height = 375: .Left = 1920: .Width = 1650
.Text = "Identification Number"
.DataField = Name
.DataSource = dSlider 'object variable or with block not set
End With
Jan 11 '07 #1
2 3234
Killer42
8,435 Expert 8TB
From VB online help...

Note Two older controls, the Data control and RemoteData control, can be used as data sources, however you cannot set the DataSource property of another control or object to either of these controls at run time. For example, the following code will fail:
Expand|Select|Wrap|Line Numbers
  1. Set Text1.DataSource = Data1 ' Will fail! You can't set DataSource at
  2.                              ' run time to an intrinsic Data control.
To use either the Data control or RemoteData control as a data source, you can set the DataSource property of bound controls at design time only.
Jan 11 '07 #2
vbLeo
2
Thanks, Kill42, for your very swift reply! Too bad it wasn't what I wanted to hear (however, it was what I needed to hear). I'll try some other design approach to get around not being able to dynamically bind to a data control. Thanks again for the helpful information.
Jan 11 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: lawrence | last post by:
I thought I was fighting a PHP problem, so I asked about this on a PHP list, but they felt it was a Javascript problem, so I'm reposting a bit of the debate here. Could this Javascript, below,...
2
by: Adam Clauss | last post by:
Basically, my question is in terms of performance and the garbage collector - Is there any difference between a) letting a variable simply go out of scope b) explicity setting it to null once I am...
12
by: Joe | last post by:
I might be overworked so please excuse this stupid question... Say I do the following: DataTable table = new DataTable(); myDataAdaptor.Fill(table); dataGrid1.DataSource = table;
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
2
by: Fred Exley | last post by:
The first time I enter a page, I want to set a variable once, and have that variable retain its value from that point on. So on the first time in the program, I set runLoc = "yes". When I then...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
10
by: Brad Baker | last post by:
I have an asp.net/csharp application that requires a particular variable to work properly. This variable is usually passed via a query string in the URL when the application is first run but under...
1
by: Thelma Roslyn Lubkin | last post by:
I have a form with several comboboxes whose contents I'm trying to initialize from a table. The table, ComboSelections, has 3 fields, an autonumber ID and two text fields, ListCode and ListEntry....
6
by: DippyDog | last post by:
This is an old old post that I'm referencing regarding what happens when you set an integer variable to Nothing. It gets set to zero, not "Nothing." ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.