Copyright: Copyright © 1993-1997 Sheridan Software Systems


Contents
Frequently Asked Questions (by topic)	Back to main help contents

Conversion | Data Binding | Formatting | Searching | Moving/Copying | Programming

To see this list categorized by control, click here. By FAQ number, click here.

Conversion Issues

DAT1304	How is Data Widgets 3.1 different from Data Widgets 1.0?

DAT1305	What is the best method of learning Data Widgets 3.1?

DAT1306	Is there an automatic conversion utility available when converting from Data Widgets 1.0 to Data Widgets 3.1?

DAT1337	When distributing my application that has a Data Widgets 3.1 control included, the Form will open, but will return an error "Can't Load Custom Control DLL".

DAT1345	What are the FILENAMES of the controls in Data Widgets 3.1?

Data Binding Issues

DAT1307	How can I write all of the data that resides in an Additem SSDBGrid into a database?

DAT1308	How can I trap for messages through the DBEngine directly and display the Error Number and Error Description from DAO?

DAT1309	When using SQLPassThrough the SSDBCombo's ListAutoPosition and ListAutoValidate no longer works, why?

DAT1310	Why do I get an error when I bind the SSDBCombo's DataSource to a MSRDC control and perform a MSRDC1.ResultSet.Update?

DAT1311	When I bind the SSDBCombo’s DataSourceList to a DataControl and choose an item from the list, my other bound controls do not reflect the same record.

DAT1328	If I am loading an Additem SSDBGrid with a dynaset, how can I synchronize the dynaset with the SSDBGrid?

DAT1359	When binding the Data Widgets controls to an ODBC source, why does the load time seem slow?

Formatting & Design Issues

DAT1312	When I set the CellStyleSet to a particular cell then scroll the cell out of view, the CellStyleSet is no longer applied when the cell scrolls back into view - how can I fix this?

DAT1314	How would I color a row in the SSDBGrid based upon what has been entered into a cell?

DAT1349	When starting the Custom DataGrid Editor, why do I get an error 31037 "Error loading from file"?

DAT1361	When trying to toggle the Column Object's Style property from Edit to Button in the SSDBGrid's RowColChange event, the Button does not redraw properly.

DAT1362	When using Visual C++, how can I apply a bitmap to a picture property in a Data Widgets control?

Search and Retrieval

DAT1317	The Enhanced Data Control displays a message box when the Find function does not find anything. How can I post my own message instead of the default message?

DAT1348	How can I search for a string in a column of the SSDBGrid?

DAT1351	How can I put default search strings and selection criteria in the FindDialog of the EDC without having to construct my own FindDialog?

DAT1366	Why won't the SSDBCombo's List portion close when I select an item from the list?

Moving and Copying Data

DAT1318	How can I drag an entire row from one AddItem SSDBGrid to another AddItem SSDBGrid?

DAT1319	How can I copy the contents of a bound SSDBGrid to an AddItem SSDBGrid?

DAT1320	How can I select a consecutive number of cells in the SSDBGrid and copy the cell's contents to the clipboard?

DAT1321	Using the AllowDragDrop from cell to cell that is built into the SSDBGrid overwrites the existing text, How can I copy text from cell to cell in an AddItem SSDBGrid using the mouse without overwriting any existing text?

DAT1350	How do I copy the SSDBGrid contents to the ClipBoard?

Programmatic Control

DAT1316	How can I place the Record number of the row in an Unbound Column of a bound SSDBGrid?

DAT1323	How would I use one SSDBDropDown to update several columns on a SSDBGrid?

DAT1324	When using an unbound SSDBGrid, how can I display a value from my dynaset in a text box as I change rows?

DAT1325	How can I compare the LastRow parameter in the RowColChange event with the current bookmark for the SSDBGrid?

DAT1326	How can I lock a cell in a bound SSDBGrid?

DAT1327	How can I total a column in the SSDBGrid?

DAT1329	How can I update a SSDBGrid without moving off the row or if the SSDBGrid loses focus?

DAT1330	How can I synchronize the horizonal scrolling of two SSDBGrids?

DAT1331	How can I determine if I am loading an EvenRow or an OddRow in the Bound SSDBGrid?

DAT1332	How can I check if the current row in the SSDBGrid is selected or deselected?

DAT1333	How can I loop through the SelBookmarks collection in the order they appear on the SSDBGrid, not in the order they were selected?

DAT1335	How can I manually 'ListAutoPosition' through an AddItem SSDBCombo list using all entered characters?

DAT1336	How do I know what Row I am on in a SSDBGrid?

DAT1338	Why isn't the SSDBCombo or SSDBDropdown dropping down?

DAT1339	How can I programmatically select a row?

DAT1346	How can I create an Unbound SSDBGrid?

DAT1347	Can I insert a row in the middle of the SSDBGrid?

DAT1352	How do I load an array into an Unbound Column for a Bound SSDBGrid?

DAT1353	How do I set a particular row in an AddItem SSDBCombo to be the current row?

DAT1354	How can I control the order in which each of the Data Widgets controls fire its InitColProps event?

DAT1355	How do I load a value only once in a column of the SSDBGrid?

DAT1356	How do I have the current row select when I use the up and down arrow keys in the SSDBGrid?

DAT1357	When using the SSDBCombo in Visual C++, why will a character typed in the edit portion appear for a second then disappear?

DAT1358	How can I programmatically cause the SSDBDropDown to DropDown within the DataGrid?

DAT1360	I am writing a VC++ application with Data Widgets and noticed that the C++ wrapper for the controls has no implementation for GotFocus and LostFocus events? Has this been an oversight or is there another way to capture these events?

DAT1363	How would I cancel the update in the BeforeColUpdate event and keep the new value the user has entered?

DAT1364	How can I set a default value in the addrow of the SSDBGrid programmatically?

DAT1365	How can I create an Unbound SSDBCombo?


Contents Controls
Frequently Asked Questions (by control)	Back to main help contents

Grid | Combo/DropDown | EDC | General

To see this list categorized by topic, click here.  By FAQ number, click here.

SSDBGrid

DAT1307	How can I write all of the data that resides in an Additem SSDBGrid into a database?

DAT1308	How can I trap for messages through the DBEngine directly and display the Error Number and Error Description from DAO?

DAT1312	When I set the CellStyleSet to a particular cell then scroll the cell out of view, the CellStyleSet is no longer applied when the cell scrolls back into view - how can I fix this?

DAT1314	How would I color a row in the SSDBGrid based upon what has been entered into a cell?

DAT1316	How can I place the Record number of the row in an Unbound Column of a bound SSDBGrid?

DAT1318	How can I drag an entire row from one AddItem SSDBGrid to another AddItem SSDBGrid?

DAT1319	How can I copy the contents of a bound SSDBGrid to an AddItem SSDBGrid?

DAT1320	How can I select a consecutive number of cells in the SSDBGrid and copy the cell's contents to the clipboard?

DAT1321	Using the AllowDragDrop from cell to cell that is built into the SSDBGrid overwrites the existing text, How can I copy text from cell to cell in an AddItem SSDBGrid using the mouse without overwriting any existing text?

DAT1323	How would I use one SSDBDropDown to update several columns on a SSDBGrid?

DAT1324	When using an unbound SSDBGrid, how can I display a value from my dynaset in a text box as I change rows?

DAT1325	How can I compare the LastRow parameter in the RowColChange event with the current bookmark for the SSDBGrid?

DAT1326	How can I lock a cell in a bound SSDBGrid?

DAT1327	How can I total a column in the SSDBGrid?

DAT1328	If I am loading an Additem SSDBGrid with a dynaset, how can I synchronize the dynaset with the SSDBGrid?

DAT1329	How can I update a SSDBGrid without moving off the row or if the SSDBGrid loses focus?

DAT1330	How can I synchronize the horizonal scrolling of two SSDBGrids?

DAT1331	How can I determine if I am loading an EvenRow or an OddRow in the Bound SSDBGrid?

DAT1332	How can I check if the current row in the SSDBGrid is selected or deselected?

DAT1333	How can I loop through the SelBookmarks collection in the order they appear on the SSDBGrid, not in the order they were selected?

DAT1336	How do I know what Row I am on in a SSDBGrid?

DAT1339	How can I programmatically select a row?

DAT1346	How can I create an Unbound SSDBGrid?

DAT1347	Can I insert a row in the middle of the SSDBGrid?

DAT1348	How can I search for a string in a column of the SSDBGrid?

DAT1349	When starting the Custom DataGrid Editor, why do I get an error 31037 "Error loading from file"?

DAT1350	How do I copy the SSDBGrid contents to the ClipBoard?

DAT1352	How do I load an array into an Unbound Column for a Bound SSDBGrid?

DAT1353	How do I set a particular row in an AddItem SSDBCombo to be the current row?

DAT1355	How do I load a value only once in a column of the SSDBGrid?

DAT1356	How do I have the current row select when I use the up and down arrow keys in the SSDBGrid?

DAT1357	When using the SSDBCombo in Visual C++, why will a character typed in the edit portion appear for a second then disappear?

DAT1361	When trying to toggle the Column Object's Style property from Edit to Button in the SSDBGrid's RowColChange event, the Button does not redraw properly.

DAT1363	How would I cancel the update in the BeforeColUpdate event and keep the new value the user has entered?

DAT1364	How can I set a default value in the addrow of the SSDBGrid programmatically?

SSDBCombo & SSDBDropDown

DAT1309	When using SQLPassThrough the SSDBCombo's ListAutoPosition and ListAutoValidate no longer works, why?

DAT1310	Why do I get an error when I bind the SSDBCombo's DataSource to a MSRDC control and perform a MSRDC1.ResultSet.Update?

DAT1311	When I bind the SSDBCombo’s DataSourceList to a DataControl and choose an item from the list, my other bound controls do not reflect the same record.

DAT1335	How can I manually 'ListAutoPosition' through an AddItem SSDBCombo list using all entered characters?

DAT1338	Why isn't the SSDBCombo or SSDBDropdown dropping down?

DAT1358	How can I programmatically cause the SSDBDropDown to DropDown within the DataGrid?

DAT1365	How can I create an Unbound SSDBCombo?

DAT1366	Why won't the SSDBCombo's List portion close when I select an item from the list?

Enhanced Data Control

DAT1317	The Enhanced Data Control displays a message box when the Find function does not find anything. How can I post my own message instead of the default message?

DAT1351	How can I put default search strings and selection criteria in the FindDialog of the EDC without having to construct my own FindDialog?

General Control Questions

DAT1304	How is Data Widgets 3.1 different from Data Widgets 1.0?

DAT1305	What is the best method of learning Data Widgets 3.1?

DAT1306	Is there an automatic conversion utility available when converting from Data Widgets 1.0 to Data Widgets 3.1?

DAT1337	When distributing my application that has a Data Widgets 3.1 control included, the Form will open, but will return an error "Can't Load Custom Control DLL".

DAT1345	What are the FILENAMES of the controls in Data Widgets 3.1?

DAT1354	How can I control the order in which each of the Data Widgets controls fire its InitColProps event?

DAT1359	When binding the Data Widgets controls to an ODBC source, why does the load time seem slow?

DAT1360	I am writing a VC++ app with Data Widgets and noticed that the C++ wrapper for the controls has no implementation for GotFocus and LostFocus events? Has this been an oversight or is there another way to capture these events?

DAT1362	When using Visual C++, how can I apply a bitmap to a picture property in a Data Widgets control?


Contents Numbers
Frequently Asked Questions (by number)	Back to main help contents

To see this list categorized by topic, click here.  By control, click here.

DAT1304	How is Data Widgets 3.1 different from Data Widgets 1.0?

DAT1305	What is the best method of learning Data Widgets 3.1?

DAT1306	Is there an automatic conversion utility available when converting from Data Widgets 1.0 to Data Widgets 3.1?

DAT1307	How can I write all of the data that resides in an Additem SSDBGrid into a database?

DAT1308	How can I trap for messages through the DBEngine directly and display the Error Number and Error Description from DAO?

DAT1309	When using SQLPassThrough the SSDBCombo's ListAutoPosition and ListAutoValidate no longer works, why?

DAT1310	Why do I get an error when I bind the SSDBCombo's DataSource to a MSRDC control and perform a MSRDC1.ResultSet.Update?

DAT1311	When I bind the SSDBCombo’s DataSourceList to a DataControl and choose an item from the list, my other bound controls do not reflect the same record.

DAT1312	When I set the CellStyleSet to a particular cell then scroll the cell out of view, the CellStyleSet is no longer applied when the cell scrolls back into view - how can I fix this?

DAT1314	How would I color a row in the SSDBGrid based upon what has been entered into a cell?

DAT1316	How can I place the Record number of the row in an Unbound Column of a bound SSDBGrid?

DAT1317	The Enhanced Data Control displays a message box when the Find function does not find anything. How can I post my own message instead of the default message?

DAT1318	How can I drag an entire row from one AddItem SSDBGrid to another AddItem SSDBGrid?

DAT1319	How can I copy the contents of a bound SSDBGrid to an AddItem SSDBGrid?

DAT1320	How can I select a consecutive number of cells in the SSDBGrid and copy the cell's contents to the clipboard?

DAT1321	Using the AllowDragDrop from cell to cell that is built into the SSDBGrid overwrites the existing text, How can I copy text from cell to cell in an AddItem SSDBGrid using the mouse without overwriting any existing text?

DAT1323	How would I use one SSDBDropDown to update several columns on a SSDBGrid?

DAT1324	When using an unbound SSDBGrid, how can I display a value from my dynaset in a text box as I change rows?

DAT1325	How can I compare the LastRow parameter in the RowColChange event with the current bookmark for the SSDBGrid?

DAT1326	How can I lock a cell in a bound SSDBGrid?

DAT1327	How can I total a column in the SSDBGrid?

DAT1328	If I am loading an Additem SSDBGrid with a dynaset, how can I synchronize the dynaset with the SSDBGrid?

DAT1329	How can I update a SSDBGrid without moving off the row or if the SSDBGrid loses focus?

DAT1330	How can I synchronize the horizonal scrolling of two SSDBGrids?

DAT1331	How can I determine if I am loading an EvenRow or an OddRow in the Bound SSDBGrid?

DAT1332	How can I check if the current row in the SSDBGrid is selected or deselected?

DAT1333	How can I loop through the SelBookmarks collection in the order they appear on the SSDBGrid, not in the order they were selected?

DAT1335	How can I manually 'ListAutoPosition' through an AddItem SSDBCombo list using all entered characters?

DAT1336	How do I know what Row I am on in a SSDBGrid?

DAT1337	When distributing my application that has a Data Widgets 3.1 control included, the Form will open, but will return an error "Can't Load Custom Control DLL".

DAT1338	Why isn't the SSDBCombo or SSDBDropdown dropping down?

DAT1339	How can I programmatically select a row?

DAT1345	What are the FILENAMES of the controls in Data Widgets 3.1?

DAT1346	How can I create an Unbound SSDBGrid?

DAT1347	Can I insert a row in the middle of the SSDBGrid?

DAT1348	How can I search for a string in a column of the SSDBGrid?

DAT1349	When starting the Custom DataGrid Editor, why do I get an error 31037 "Error loading from file"?

DAT1350	How do I copy the SSDBGrid contents to the ClipBoard?

DAT1351	How can I put default search strings and selection criteria in the FindDialog of the EDC without having to construct my own FindDialog?

DAT1352	How do I load an array into an Unbound Column for a Bound SSDBGrid?

DAT1353	How do I set a particular row in an AddItem SSDBCombo to be the current row?

DAT1354	How can I control the order in which each of the Data Widgets controls fire its InitColProps event?

DAT1355	How do I load a value only once in a column of the SSDBGrid?

DAT1356	How do I have the current row select when I use the up and down arrow keys in the SSDBGrid?

DAT1357	When using the SSDBCombo in Visual C++, why will a character typed in the edit portion appear for a second then disappear?

DAT1358	How can I programmatically cause the SSDBDropDown to DropDown within the DataGrid?

DAT1359	When binding the Data Widgets controls to an ODBC source why does the load time seem slow?

DAT1360	I am writing a VC++ app with Data Widgets and noticed that the C++ wrapper for the controls has no implementation for GotFocus and LostFocus events? Has this been an oversight or is there another way to capture these events?

DAT1361	When trying to toggle the Column Object's Style property from Edit to Button in the SSDBGrid's RowColChange event, the Button does not redraw properly.

DAT1362	When using Visual C++, how can I apply a bitmap to a picture property in a Data Widgets control?

DAT1363	How would I cancel the update in the BeforeColUpdate event and keep the new value the user has entered?

DAT1364	How can I set a default value in the addrow of the SSDBGrid programmatically?

DAT1365	How can I create an Unbound SSDBCombo?

DAT1366	Why won't the SSDBCombo's List portion close when I select an item from the list?


Copyright Notice
Sheridan Data Widgets™ 3.1 Frequently Asked Questions

Copyright © 1993-1998 Sheridan Software Systems, Inc.  All rights reserved.

This file is part of the Data Widgets 3.1 help system and may not be distributed separately. It is governed by the Data Widgets 3.1 copyright and license agreement. See the Data Widgets 3.1 copyright notice for further details. You can view this notice by clicking "Copyright Notice" in the banner of the main contents topic for the Data Widgets 3.1 help file.


DAT1304
How is Data Widgets 3.1 different from Data Widgets 1.0?

DAT1304

Updated December 17, 1997.

These are the main differences between version 1.X and 3.X of the DataWidgets controls:

1. They are no longer in the VBX format, they are now 16-bit and 32-bit ActiveX controls.

2. The ActiveX format utilizes Microsoft’s OLE automation specifications.

3. Our ActiveX controls can now be used on a range of development environments, whereas in the past, the product was limited to environments that supported the VBX format.

4. Version 3.1 of Data Widgets introduces the use of objects and collections. Objects allow you to more easily manipulate the custom controls. For example, you can now directly set a property specific to an object (such as an individual column).


DAT1305
What is the best method of learning Data Widgets 3.1?

DAT1305

Updated December 17, 1997.

If you are upgrading from version 2.0, everything you know about Data Widgets will carry over to the new version. Version 3.1 adds new functionality to the previous version, but is otherwise the same. To get started with the new features, consult the "Task-Based Help" section of the help file and look for the sections marked as New. There is also a new tutorial for the Data Grid that will introduce you to some of the new features.

If you are upgrading from version 1.0, part of the difficulty with learning Data Widgets 3.1 is due to the OLE features of Objects and Collections. Once you understand this technology, you will have no problem familiarizing yourself with Data Widgets 3.1.

The manual provides a Guided Tour section which is a basic, but thorough approach to familiarizing yourself with each component and their most common uses. Once you understand the basics of how to use each control, you will better understand the properties and methods that are applicable to that component.

You may want to review each of the collections used in Data Widgets to gain an understanding of the objects the collection comprises. You can then review the properties of each object.

For example, there is a Columns collection that is composed of Column objects. This collection (like any collection) enables you to add objects to it, remove objects from it, or count how many objects it currently holds. If you wish to refer to an individual Column object, you refer to it by its place in the collection. Thus, the first Column object added to the collection would be referred to as Columns(0).

If you wish to set certain attributes of Columns(0) you would then refer to the Column object and its properties. You can set the Text, Caption, Style, BackColor, etc. properties of this Column. Each would be referred by using the Column object and its place in the Columns collection:

SSDBGrid1.Columns(0).Text = "Hello World"

SSDBGrid1.Columns(0).Caption = "Name"

This does not mean that you will learn every property, method or event, but once you have a better understanding of how objects and collections work you will have an easier time looking for help on a specific property or method you would like to use.


DAT1306
Is there an automatic conversion utility available when converting from Data Widgets 1.0 to Data Widgets 3.1?

DAT1306

Updated December 17, 1997.

No.

Note	For information on converting from Data Widgets 2.0 to Data Widgets 3.1 see the Readme notes or the Upgrading to Data Widgets 3.1 section of the help file. There is an automated utility that will upgrade your Data Widgets 2.0 files to version 3.1.

There are significant differences between the Data Widgets 1.0 components and the Data Widgets 3.1 components.  Besides making full use of the latest OLE technology, we included many new features and enhancements that were requested by our customers.  An automatic conversion would not make use of the new properties and the object and collection architecture now supported in OLE technology.

For example, in Data Widgets version 1.0 you obtained a cell's value by using an element of an indexed property array - the ColText property of the DataGrid:

sColumnText = SSDataGrid1.ColText(n)

In Data Widgets version 3.1 or later the columns are now a part of a collection of Column objects.  Array properties and subscripts are no longer used. To obtain the same information, you would use the Text property of the Column object:

sColumnText = SSDBGrid1.Columns(n).Text

This is just a small sample of how the differences apply.  While we do realize the manual conversion can be a time consuming process, we have included a help file, DATW1TO3.HLP that will help with the process.  This file lists all the Data Widgets 1.0 Properties, Events & Methods that were supported and explains how you can achieve the same functionality in Data Widgets version 3.1.


DAT1307
How can I write all of the data that resides in an Additem SSDBGrid into a database?

DAT1307

Updated December 17, 1997.

The following procedure will store the entire contents of the AddItem SSDBGrid in a database. This code assumes that you have a Data Control on the Form that is attached to a recordset that contains the same number of fields as columns in the SSDBGrid.

Private Sub Command1_Click()

For i = 0 To SSDBGrid1.Rows - 1

Data1.Recordset.AddNew

For x = 0 To SSDBGrid1.Columns.Count - 1

Data1.Recordset(x) = SSDBGrid1.Columns(x).CellText(SSDBGrid1.AddItemBookmark(i))

Next x

Data1.Recordset.Update

Next i

End Sub


DAT1308
How can I trap for messages through the DBEngine directly and display the Error Number and Error Description from DAO?

DAT1308

Updated December 17, 1997.

This code will give you an idea of how to handle errors from DBEngine.

Private Sub SSDBGrid1_AfterUpdate(RtnDispErrMsg As Integer)

If DBEngine.Errors.Count Then

RtnDispErrMsg = False	'Turn off SSDBGrid default message

MsgBox "Error:  " & DBEngine.Errors(0).Number & "    " & "Description: " _

DBEngine.Errors(0).Description, 32

End If

End Sub


DAT1309
When using SQLPassThrough the SSDBCombo's ListAutoPosition and ListAutoValidate no longer works, why?

DAT1309

Updated December 17, 1997.

Working with SQLPassThrough disables all search mechanisms. This is a limitation inherent to Visual Basic. Therefore, the SSDBCombo will no longer be able to perform the ListAutoPosition or the ListAutoValidate methods.


DAT1310
Why do I get an error when I bind the SSDBCombo's DataSource to a MSRDC control and perform a MSRDC1.ResultSet.Update?

DAT1310

Updated December 17, 1997.

This is a problem with the Microsoft Remote Data Control. The problem can be reproduced with the Microsoft Masked Edit Control.


DAT1311
When I bind the SSDBCombo’s DataSourceList to a DataControl and choose an item from the list, my other bound controls do not reflect the same record.

DAT1311

Updated December 17, 1997.

You must manually reposition the Data control to achieve this effect.

When choosing an item from the list, you are moving the position of the SSDBCombo, but it is not repositioning the bound DataControl. This is done to increase the speed of positioning of the SSDBCombo.

You can set the Data control’s bookmark equal to the SSDBCombo's bookmark and it will keep the other bound controls in sync with the SSDBCombo.

In the CloseUp event of the SSDBCombo put the following code:

Private Sub SSDBCombo1_Click()

    Data1.Recordset.Bookmark = SSDBCombo1.Bookmark

End Sub


DAT1312
When I set the CellStyleSet to a particular cell then scroll the cell out of view, the CellStyleSet is no longer applied when the cell scrolls back into view - how can I fix this?

DAT1312

Updated December 17, 1997.

in order to get this effect, you need to a field in the Database associated with the Styleset. Whenever this field contains a certain value, you should apply this styleset to the SSDBGrid in the RowLoaded event.

Use the following procedure:

Place a SSDBGrid and Command Button on the form and add the following code:

(General)(declarations)

Dim temp as String

Private Sub Form_Load()

temp = ""

SSDBGrid1.StyleSets("color").BackColor = RGB(255, 55, 55)

End Sub

Private Sub Command1_Click()

SSDBGrid1.Columns(1).CellStyleSet ("color"), SSDBGrid1.Row

temp = SSDBGrid1.Columns(1).CellValue(SSDBGrid1.Bookmark)

End Sub

Private Sub SSDBGrid1_RowLoaded(ByVal Bookmark As Variant)

If SSDBGrid1.Columns(1).Text = temp Then

SSDBGrid1.Columns(1).CellStyleSet ("color")

Else

SSDBGrid1.Columns(1).CellStyleSet ""

End If

End Sub


DAT1314
How would I color a row in the SSDBGrid based upon what has been entered into a cell?

DAT1314

Updated December 17, 1997.

To get this effect you must have a column somewhere in the SSDBGrid that holds a value that determines the color that row should be.

For example, this sample checks the value that is in Column 0 and decides which color to apply to the row.

Private Sub Form_Load()

'Define the stylesets here.

SSDBGrid1.StyleSets("yesStyle").BackColor = RGB(255, 0, 0)

SSDBGrid1.StyleSets("noStyle").BackColor = RGB(0, 255, 0)

End Sub

Private Sub SSDBGrid1_RowLoaded(ByVal Bookmark As Variant)

Dim i As Integer

If SSDBGrid1.Columns(0).Text = "no" Then

For i = 0 To SSDBGrid1.Cols - 1

SSDBGrid1.Columns(i).CellStyleSet "noStyle"

Next i

ElseIf SSDBGrid1.Columns(0).Text = "yes" Then

For i = 0 To SSDBGrid1.Cols - 1

SSDBGrid1.Columns(i).CellStyleSet "yesStyle"

Next i

Else

'Do not apply any styleset.

For i = 0 To SSDBGrid1.Cols - 1

SSDBGrid1.Columns(i).CellStyleSet ""

Next i

End If

End Sub


DAT1316
How can I place the Record number of the row in an Unbound Column of a bound SSDBGrid?

DAT1316

Updated December 17, 1997.

The following procedure adds an unbound row number column to a bound DataGrid:

Note	This code will only work if the RecordsetType property of the Data Control is set to "1-Dynaset".

Dim flag As Boolean

Dim rs As Recordset

Private Sub Form_Activate()

flag = True

Set rs = Data1.Recordset.Clone()

End Sub

Private Sub SSDBGrid1_InitColumnProps()

SSDBGrid1.Columns.Add 0

End Sub

Private Sub SSDBGrid1_RowLoaded(ByVal Bookmark As Variant)

If flag = True Then

rs.Bookmark = Bookmark

SSDBGrid1.Columns(0).Text = rs.AbsolutePosition

End If

End Sub


DAT1317
The Enhanced Data Control displays a message box when the Find function does not find anything. How can I post my own message instead of the default message?

DAT1317

Updated December 17, 1997.

You must set the RtnDispErrMsg parameter of the FindResult event to False, then display your own message through code.

In the FindResult event place this code:

If CStr(vBookmark) = "" Then

MsgBox "MyMessage"

RtnDispErrMsg = False

End If


DAT1318
How can I drag an entire row from one AddItem SSDBGrid to another AddItem SSDBGrid?

DAT1318

Updated December 17, 1997.

The following procedure shows how to drag a selected row from one grid to another: First, place two SSDBGrid's on a form - both in AddItem mode with AllowAddNew set to True, Cols set to 1. Then specify the following code for the events of each grid:

Private Sub SSDBGrid1_InitColumnProps()

For i = 0 To 20

SSDBGrid1.AddItem "Data Widgets," & i

Next i

End Sub

Public Sub SSDBGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim bm As Variant

If Button = 2 and SSDBGrid1.Whereis(X,Y) = ssWhereIsData Then	'Right mouse button clicked

SSDBGrid1.DragIcon = LoadPicture("d:\vb4\icons\dragdrop\drag1pg.ico")

SSDBGrid1.Drag 1	'Set drag action to drag

bm = SSDBGrid1.RowBookmark(SSDBGrid1.RowContaining(Y))	'Get the bookmark of the row

SSDBGrid1.Bookmark = bm	'Set the current bookmark to the row

End If

End Sub

Private Sub SSDBGrid2_DragDrop(Source As Control, X As Single, Y As Single)

SSDBGrid2.AddItem ""

For i = 0 To SSDBGrid1.Columns.Count - 1

SSDBGrid2.Columns(i).Text = SSDBGrid1.Columns(i).CellText(SSDBGrid1.Bookmark)	'Copy Grid1 contents to Grid2

Next i

SSDBGrid2.Update

SSDBGrid2.MoveNext

SSDBGrid1.Drag 2	'Drag action stopped

End Sub


DAT1319
How can I copy the contents of a bound SSDBGrid to an AddItem SSDBGrid?

DAT1319

Updated December 17, 1997.

The following procedure copies the entire contents of a data-bound grid to an AddItem grid. Place a bound SSDBGrid on a form. Place a second SSDBGrid on a form and set the following properties:

DataMode =	 "2 - AddItem"

Place a command button on the form and put the following code in the Click event. This code copies the data to the clipboard:

Private Sub Command1_Click()

Dim bm As Variant

Dim datastr As String

MousePointer = 11

'Set up SSDBGrid2's Columns

For i = 0 To SSDBGrid1.Columns.Count - 1

SSDBGrid2.Columns.Add i

SSDBGrid2.Columns(i).Caption = SSDBGrid1.Columns(i).Caption

Next i

'Get the bookmark of each row in SSDBGrid1; set the CellText

'of SSDBGrid1 to ClipBoard and copy the contents of ClipBoard

'into SSDBGrid2.

'Turning Redraw off of SSDBGrid2 optimizes the load time

SSDBGrid1.MoveFirst

SSDBGrid2.Redraw = False

For X = 0 To SSDBGrid1.Rows - 1

bm = SSDBGrid1.GetBookmark(X)

datastr = ""

For i = 0 To SSDBGrid1.Columns.Count - 1

datastr = datastr & SSDBGrid1.Columns(i).CellText(bm)

If i < SSDBGrid1.Columns.Count - 1 Then

datastr = datastr & vbTab

End If

Next i

SSDBGrid2.AddItem datastr

DoEvents

Next X

SSDBGrid2.Redraw = True

MousePointer = 0

End Sub


DAT1320
How can I select a consecutive number of cells in the SSDBGrid and copy the cell's contents to the clipboard?

DAT1320

Updated December 17, 1997.

(General) (declarations)

Dim griddata As String

Private Sub Form_Load()

'Create styleset with backcolor of red

SSDBGrid1.StyleSets("color").BackColor = RGB(255, 55, 55)

End Sub

Private Sub SSDBGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim bm As Variant

'If right mouse click

If Button = 2 Then

'Apply the styleset "color" to the cell

SSDBGrid1.Columns(SSDBGrid1.ColContaining(X)).CellStyleSet ("color"), _

SSDBGrid1.RowContaining(Y)

'Get the row's bookmark

bm = SSDBGrid1.RowBookmark(SSDBGrid1.RowContaining(Y))

'Build string of cell's contents

griddata = griddata + SSDBGrid1.Columns(SSDBGrid1.ColContaining(X)).CellText(bm)

'Copy contents to ClipBoard

Clipboard.SetText griddata

Else

'If left mouse click clear griddata and ClipBoard and clear stylesets applied to DataGrid

SSDBGrid1.Refresh

griddata = ""

Clipboard.SetText griddata

End If

End Sub


DAT1321
Using the AllowDragDrop from cell to cell that is built into the SSDBGrid overwrites the existing text. How can I copy text from cell to cell in an AddItem SSDBGrid using the mouse without overwriting any existing text?

DAT1321

Updated December 17, 1997.

Use the following in an AddItem SSDBGrid with 3 columns and FieldSeparator of comma:

(General)(declarations)

Dim tempstr$

Private Sub SSDBGrid1_DragDrop(Source As Control, X As Single, Y As Single)

Dim dropcol%

Dim bm As Variant

dropcol = SSDBGrid1.ColContaining(X)

bm = SSDBGrid1.RowBookmark(SSDBGrid1.RowContaining(Y))

If SSDBGrid1.Columns(dropcol).CellText(bm)  "" Then

MsgBox ("Entry already in cell")

Else

SSDBGrid1.Bookmark = bm

SSDBGrid1.Columns(dropcol).Text = tempstr

SSDBGrid1.Update

End If

End Sub

Private Sub SSDBGrid1_InitColumnProps()

For i = 0 To 20

SSDBGrid1.AddItem "Data Widgets," & i

Next i

End Sub

Private Sub SSDBGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 2 Then	'Right mouse button clicked

SSDBGrid1.DragIcon = LoadPicture("c:\vb4-16\icons\arrows\point04.ico")

'Set drag action to drag

SSDBGrid1.Drag 1

'Set the bookmarks of the row

SSDBGrid1.Bookmark = SSDBGrid1.RowBookmark(SSDBGrid1.RowContaining(Y))

tempstr = SSDBGrid1.Columns(SSDBGrid1.ColContaining(X)).Text

End If

End Sub


DAT1323
How would I use one SSDBDropDown to update several columns on a SSDBGrid?

DAT1323

Updated December 17, 1997.

Use the RowColChange event, as outlined in the following procedure. In this sample both columns 3 and 5 in the SSDBGrid are attached to the same SSDBDropDown control. In the RowColChange event, the RecordSource of the Data Control bound to the SSDBDropDown is changed based on the Column in the SSDBGrid.

Private Sub SSDBGrid1_InitColumnProps()

SSDBGrid1.Columns(3).DropDownHwnd = SSDBDropDown1.hWnd

SSDBGrid1.Columns(5).DropDownHwnd = SSDBDropDown1.hWnd

End Sub

Private Sub SSDBGrid1_RowColChange(ByVal LastRow As Variant, ByVal LastCol As Integer)

If SSDBGrid1.Col = 3 And Data2.RecordSource  "Publishers" Then

DoEvents

Data2.RecordSource = "Publishers"

Data2.Refresh

SSDBDropDown1.DataFieldList = "PubId"

ElseIf SSDBGrid1.Col = 5 And Data2.RecordSource  "Authors" Then

DoEvents

Data2.RecordSource = "Authors"

Data2.Refresh

SSDBDropDown1.DataFieldList = "Au_ID"

End If

End Sub


DAT1324
When using an unbound SSDBGrid, how can I display a value from my dynaset in a text box as I change rows?

DAT1324

Updated December 17, 1997.

Use the RowColChange event, as outlined in the following procedure.

Private Sub SSDBGrid1_RowColChange(ByVal LastRow As Variant, ByVal LastCol As Integer)

rs.Bookmark = SSDBGrid1.Bookmark

Text1.Text = rs("au_id")

End Sub

Or

text1.text = ssdbgrid1.columns(2).text


DAT1325
How can I compare the LastRow parameter in the RowColChange event with the current bookmark for the SSDBGrid?

DAT1325

Updated December 17, 1997.

Private Sub SSDBGrid1_RowColChange(ByVal LastRow As Variant, ByVal LastCol As Integer)

Dim bm As Variant

bm = CStr(SSDBGrid1.Bookmark)

If bm  CStr(LastRow) Then

Form1.Print "new row"

Else

Form1.Print "same row"

End If

End Sub


DAT1326
How can I lock a cell in a bound SSDBGrid?

DAT1326

Updated December 17, 1997.

Use the RowColChange event, as outlined in the following procedure. The following will lock the cell in row 5, column 1:

(General)(declarations)

Dim lockflag As Boolean

Private Sub SSDBGrid1_BeforeRowColChange(Cancel As Integer)

If lockflag = True Then

lockflag = False

SSDBGrid1.Columns(1).Locked = False

End If

End Sub

Private Sub SSDBGrid1_RowColChange(ByVal LastRow As Variant, ByVal LastCol As Integer)

If SSDBGrid1.Col = 1 And Data1.Recordset.AbsolutePosition = 5 Then

SSDBGrid1.Columns(1).Locked = True

lockflag = True

Else

SSDBGrid1.Columns(1).Locked = False

End If

End Sub


DAT1327
How can I total a column in the SSDBGrid?

DAT1327

Updated December 17, 1997.

Place a SSDBGrid (Any DataMode), Command Button and Text Box on a form. Use the following code:

(General)(declaration)

Dim temp as global integer

Private Sub Command1_Click()

SSDBGrid1.MoveFirst

For i = 0 To SSDBGrid1.Rows - 1

bm = SSDBGrid1.GetBookmark(i)

temp = temp + SSDBGrid1.Columns(0).CellValue(bm)

Next i

Text1.Text = temp

End Sub


DAT1328
If I am loading an Additem SSDBGrid with a dynaset, how can I synchronize the dynaset with the SSDBGrid?

DAT1328

Updated December 17, 1997.

The procedure below illustrates how to synchronize the movement of the DataGrid with the record pointer.

(General)(declarations)

Dim db as Database

Dim rs as Recordset

Dim strData As String

Private Sub Form_Load()

Dim i As Integer

Dim ct As Integer

Set db = OpenDatabase(App.Path & "\unbound.mdb")

Set rs = db.OpenRecordset("titles")

ct = rs.Fields.Count

SSDBGrid1.Columns.RemoveAll

For i = 0 To (ct - 1)

SSDBGrid1.Columns.Add i

SSDBGrid1.Columns(i).Visible = True

SSDBGrid1.Columns(i).Caption = rs.Fields(i).Name

Next i

 	rs.MoveFirst

Do While Not rs.EOF

For i = 0 To SSDBGrid1.Cols - 1

strData = strData & rs(i) & vbTab

Next i

SSDBGrid1.AddItem strData

strData = ""

    rs.MoveNext

Loop

End Sub

Private Sub SSDBGrid1_RowColChange(ByVal LastRow As Variant, ByVal LastCol As Integer)

rs.AbsolutePosition = SSDBGrid1.AddItemRowIndex(SSDBGrid1.Bookmark)

End Sub


DAT1329
How can I update a SSDBGrid without moving off the row or if the SSDBGrid loses focus?

DAT1329

Updated December 17, 1997.

Use the following procedure to update the recordset without changing the current row. In the SSDBGrid's LostFocus event put the following:

Private Sub SSDBGrid1_LostFocus()

If SSDBGrid1.RowChanged = True Then

SSDBGrid1.Update

End If

End Sub


DAT1330
How can I synchronize the horizonal scrolling of two SSDBGrids?

DAT1330

Updated December 17, 1997.

Use the following code in the ScrollAfter event of each SSDBGrid:

Private Sub SSDBGrid1_ScrollAfter()

SSDBGrid2.LeftCol = SSDBGrid1.LeftCol

End Sub

Private Sub SSDBGrid2_ScrollAfter()

SSDBGrid1.LeftCol = SSDBGrid2.LeftCol

End Sub

Private Sub SSDBGrid1_KeyUp(KeyCode As Integer, Shift As Integer)

'Keep synchronized horitonal scrolling when using navigation keys.

If KeyCode = vbKeyLeft Or KeyCode = vbKeyRight Or KeyCode = vbKeyTab Then

Call SSDBGrid1_ScrollAfter

End If

End Sub

If you are using the SplitterBar then the above code will not work because SSDBGrid1.LeftCol will remain at "0".  Please refer to the following sample when using the SplitterBar:

Private Sub SSDBGrid1_ScrollAfter()

Dim i%, j%, k%

i = SSDBGrid1.SplitterPos

j = SSDBGrid1.ColPosition(SSDBGrid1.Columns(0).Position + i)

k = SSDBGrid2.ColPosition(SSDBGrid2.Columns(0).Position + i)

If j > k Then

SSDBGrid2.Scroll j - k, 0

Else

If j > 0 And j  k Then

SSDBGrid2.Scroll j - k, 0

End If

End If

End Sub


DAT1331
How can I determine if I am loading an EvenRow or an OddRow in the Bound SSDBGrid?

DAT1331

Updated December 17, 1997.

Use the following code to determine the type of row being loaded.

(General)(declarations)

Dim RS As Recordset

Dim loadflag As Boolean

Private Sub Form_Activate()

loadflag = True

Set RS = Data2.Recordset.Clone

End Sub

Private Sub Form_Load()

loadflag = False

End Sub

Private Sub SSDBGrid1_RowLoaded(ByVal Bookmark As Variant)

If loadflag = True Then

RS.Bookmark = Bookmark

If RS.AbsolutePosition Mod 2 = 0 Then

Debug.Print "evenrow"

Else

Debug.Print "oddrow"

End If

End If

End Sub


DAT1332
How can I check if the current row in the SSDBGrid is selected or deselected?

DAT1332

Updated December 17, 1997.

The following code determines the selection state of the current row.

Dim Selected as boolean

For i = 0 to SSDBGrid1.Selbookmarks.count -1

If CStr(SSDBGrid1.Bookmark) = CStr(SSDBGrid1.SelBookmarks(i)) then

msgbox "Row is Selected"

Selected = true

End if

Next

If Selected = False then

msgbox "Row is Not Selected"

End If


DAT1333
How can I loop through the SelBookmarks collection in the order they appear on the SSDBGrid, not in the order they were selected?

DAT1333

Updated December 17, 1997.

Private Sub Command1_Click()

Dim bm As Variant

Dim j, i  As Integer

'MoveFirst is necessary when using GetBookmark method;

'this method is specific to the DataGrid's current location

SSDBGrid1.MoveFirst

For i = 0 To SSDBGrid1.Rows - 1

bm = SSDBGrid1.GetBookmark(i)  'get the bookmark for each row

For j = 0 To SSDBGrid1.SelBookmarks.Count - 1  'for each selected row

'If DataGrid bookmark matches selbookmark

If CStr(bm) = CStr(SSDBGrid1.SelBookmarks(j)) Then

Debug.Print SSDBGrid1.Columns(0).CellText(bm)

End If

Next j

Next i

End Sub


DAT1335
How can I manually 'ListAutoPosition' through an AddItem SSDBCombo list using all entered characters?

DAT1335

Updated December 17, 1997.

Place a SSDBCombo on a form. Set the DataMode to AddItem; Cols to 1; ListAutoPosition = false.

Private Sub SSDBCombo1_InitColumnProps()

For i = 0 To 100

SSDBCombo1.AddItem i

Next i

End Sub

Private Sub SSDBCombo1_PositionList(ByVal Text As String)

Dim i%

Dim bm As Variant

If SSDBCombo1.Text  "" Then

For i = 0 To SSDBCombo1.Rows - 1

SSDBCombo1.MoveFirst

bm = SSDBCombo1.GetBookmark(i)

If UCase(SSDBCombo1.Text) = UCase(Mid(SSDBCombo1.Columns(0).CellText(bm), 1, Len(SSDBCombo1.Text))) Then

SSDBCombo1.Bookmark = bm

Exit For

End If

Next i

End If

End Sub


DAT1336
How do I know what Row I am on in a SSDBGrid?

DAT1336

Updated December 17, 1997.

Use bookmarks to determine the row number within a recordset, or the Row property to determine which of the visible rows you are on.

Data Widgets 3.1 refers to Bookmarks only, not row numbers. This change was made due to the VB4 and later environment itself. VB uses a Bookmark when referencing a record, not a row number. The Row property in Data Widgets 3.1 pertains to the visible row number only. Every top row in the SSDBGrid will return row 0.

If you feel you do need to refer to a row number you can do the following:

If DataMode is Bound - the AbsolutePosition of the DataControl (RecordSetType of Dynaset only) will return the Row number:

lAbsoluteRow = Data1.RecordSet.AbsolutePosition

If DataMode is Unbound - if you were using a RecordSet, the same properties would apply as if it were bound. You can use the same as above.

lAbsoluteRow = RecordSet.AbsolutePosition

If DataMode is AddItem - the AddItemRowIndex method in this DataMode returns an absolute row number of the given bookmark.

lAddItemRow = SSDBGrid1.AddItemRowIndex(SSDBGrid1.Bookmark)

To get the Column number the same would apply in all DataModes.

iColumn = SSDBGrid1.Col


DAT1337
When distributing my application that has a Data Widgets 3.1 control included, the Form will open, but will return an error "Can't Load Custom Control DLL".

DAT1337

Updated December 17, 1997.

You must correctly distribute and register all the DLLs needed by Data Widgets 3.1.

There are specific DLLs needed by Data Widgets in order to register the control and make use of the OLE technology. These DLLs are not included when running the Setup Wizard in Visual Basic or any other Setup Utility

The DLLs required can be found on the Data Widgets 3.1 on-line help in the Technical Specifications section "Distributing Your Application". The DLLs you need do vary depending on which environment you are supporting (16-bit and/or 32-bit applications) and are listed accordingly in this section.

For further troubleshooting installation problems on development or client machines, please refer to the "Miscellaneous Files" section of our web site (http://www.shersoft.com) for INSTALL-2.ZIP.


DAT1338
Why isn't the SSDBCombo or SSDBDropdown dropping down?

DAT1338

Updated December 17, 1997.

The DataFieldList property is not set correctly.

Whether you are using the SSDBCombo or SSDBDropdown in Bound; Unbound; or AddItem DataMode you need to set the DataFieldList property. This property tells the control which Column from the list you would like to appear in the Edit Portion when selected. Without setting this property the control will not drop down.

Please note for Bound DataMode the DataFieldList can be set to a Field name within the Table, but for both Unbound and AddItem DataModes the DataFieldList must be set to the column's internal position. For example:

SSDBCombo1.DataFieldList = "Column 0"

You can not use a Field name or the Column's name when in Unbound or AddItem DataMode.


DAT1339
How can I programmatically select a row?

DAT1339

Updated December 17, 1997.

Add it to the SelBookmarks collection.

To programmatically select a row you must add it to the SelBookmarks collection. This collection holds all the selected rows bookmarks in the order they were selected.

Please note to remove a row from the SellBookmarks collection; you must remove the index from the collection, not the bookmark.

'The following selects the current row:

SSDBGrid1.SelBookmarks.Add SSDBGrid1.Bookmark

'The following deselects the current row:

SSDBGrid1.SelBookmarks.Remove 0


DAT1345
What are the FILENAMES of the controls in Data Widgets 3.1?

DAT1345

Updated September 1, 1998.

SSDW3A16.OCX	16-Bit  SSDBData (EDC), SSDBOptSet, SSDBCommand

SSDW3B16.OCX	16-Bit  SSDBGrid, SSDBDropDown, SSDBCombo

SSDW3A32.OCX	32-Bit  SSDBData (EDC), SSDBOptSet, SSDBCommand

SSDW3B32.OCX	32-Bit  SSDBGrid, SSDBDropDown, SSDBCombo

SSDW3AO.OCX	32-Bit  SSDBData (EDC), SSDBOptSet, SSDBCommand
(Use only to support OLE DB / ADO)

SSDW3BO.OCX	32-Bit  SSDBGrid, SSDBDropDown, SSDBCombo
(Use only to support OLE DB / ADO)


DAT1346
How can I create an Unbound SSDBGrid?

DAT1346

Updated December 17, 1997.

Please review the Samples Subdirectory, EX5UNBND.VBP. The project fully demonstrates loading an unbound SSDBGrid with a Recordset; adding new records, deleting existing records and updating.


DAT1347
Can I insert a row in the middle of the SSDBGrid?

DAT1347

Updated December 17, 1997.

When working with a Database in the Bound or Unbound DataModes; standard VB behavior does not allow a row to be inserted in a middle of a table.

The AddItem DataMode is the only DataMode that will support the insert of a row in the middle:

SSDBGrid1.AddItem "", n	'n is the row number you wish to insert


DAT1348
How can I search for a string in a column of the SSDBGrid?

DAT1348

Updated December 17, 1997.

Place a SSDBGrid on a form (applies to all three DataModes). Place a text box on a form. Place a command button on the form, put the following code in the click event:

Private Sub Command1_Click()

'This code is designed to search for the contents of the

'text box in column 1 of the DataGrid.

Dim bm As Variant

SSDBGrid1.Redraw = False

SSDBGrid1.MoveFirst

For i = 0 To SSDBGrid1.Rows - 1

bm = SSDBGrid1.GetBookmark(i)

If Text1.Text = SSDBGrid1.Columns(0).CellText(bm) Then

SSDBGrid1.Bookmark = SSDBGrid1.GetBookmark(i)

Exit For

End If

Next i

SSDBGrid1.Redraw = True

End Sub


DAT1349
When starting the Custom DataGrid Editor, why do I get an error 31037 "Error loading from file"?

DAT1349

Updated December 17, 1997.

This error occurs when the shared system files:

THREED16.OCX and/or THREED32.OCX,

TABCTL16.OCX and/or TABCLT32.OCX,

MSOUTL16.OCX and/or MSOUTL32.OCX,

COMDLG16.OCX and/or COMDLG32.OCX

are not registered on your system. This occurs occasionally when an application's uninstall program mishandles the un-registration and removal of its support files.

When the Data Widgets install program installs a shared system file, it first checks to make sure that the version it is about to install is newer than that which already exists on your system. If it is newer, the install program proceeds to copy the file and then registers it. If a newer version of the file already exists on your system, the file is not copied and is not registered (It is not registered because existing system file are assumed to be registered and used by other applications).

When any of these files are no longer registered, but can still be found on your system - you will receive the error "31037 - Error Loading From File" when executing the Custom Property Pages.

As a measure to correct this problem, you can manually register the file(s) using REGSVR.EXE (for 16 bit controls) or REGSVR32.EXE (for 32-bit controls)

Also, be aware that these 4 files are included and installed automatically by Visual Basic 4.0, but NOT by Visual Basic 5.0. If you were using 4.0 and upgraded to 5.0 and then uninstalled 4.0, you need to manually re-install these files from the Visual Basic 5.0 CD. The files are located on the CD in the TOOLS\CONTROLS directory. This directory contains a README.TXT file which explains how to install these files for Design-time use.


DAT1350
How do I copy the SSDBGrid contents to the ClipBoard?

DAT1350

Updated December 17, 1997.

Dim GridData as string

Dim bm as variant

Dim i as integer

Dim a as integer

GridData = ""

SSDBGrid1.MoveFirst

For i = 0 to SSDBGrid1.rows - 1

bm = SSDBGrid1.GetBookmark(i)

For a = 0 to SSDBGrid1.cols - 1

griddata = griddata & SSDBGrid1.Columns(a).CellText(bm) & ""

Next a

Next i

Clipboard.SetText GridData


DAT1351
How can I put default search strings and selection criteria in the FindDialog of the EDC without having to construct my own FindDialog?

DAT1351

Updated December 17, 1997.

Use the SendKeys statement:

Private Sub SSDBData1_ShowFindDialog()

DoEvents	'Give time to show the dialog

SendKeys "*"	'Send a default string - an asterisk

SendKeys "%L"	'Choose L for Less than

SendKeys "%D"	'Choose D to search down

SendKeys "{TAB}"	'Tab to field list box

SendKeys "{PGUP}"	'Go to the top of the list

SendKeys "{down 3}"	'Arrow down to the default field

End Sub


DAT1352
How do I load an array into an Unbound Column for a Bound SSDBGrid?

DAT1352

Updated December 17, 1997.

(General)(declarations)

Dim array() As Integer

Private Sub Command1_Click()

array(Data1.Recordset.AbsolutePosition) = array(Data1.Recordset.AbsolutePosition) + 1

SSDBGrid1.Refresh

End Sub

Private Sub SSDBGrid1_InitColumnProps()

ReDim array(Data1.Recordset.RecordCount)

End Sub

Private Sub SSDBGrid1_RowLoaded(ByVal Bookmark As Variant)

Dim rs As Recordset

Set rs = Data1.Recordset.Clone

rs.Bookmark = Bookmark

SSDBGrid1.Columns(2).Text = array(rs.AbsolutePosition)

End Sub


DAT1353
How do I set a particular row in an AddItem SSDBCombo to be the current row?

DAT1353

Updated December 17, 1997.

Use this code after the SSDBCombo has been loaded:

SSDBCombo1.Bookmark = SSDBCombo1.AddItemBookmark(n)

SSDBCombo1.Text = SSDBCombo1.Columns(n).Text


DAT1354
How can I control the order in which each of the Data Widgets controls fires its InitColProps event?

DAT1354

Updated December 17, 1997.

You cannot.

This is something that is beyond the control of any OCX component. The ordering is deteremined by the host environment, and we would not advise you to depend on the events occurring in any specific order.


DAT1355
How do I load a value only once in a column of the SSDBGrid?

DAT1355

Updated December 17, 1997.

The following code will work for all three data modes. Each variable will be used in the RowLoaded event. getvalue is a flag to check if you want to load the text value, timesloaded is a counter to check how many times this value was loaded, and valueloaded stores the text string so you can compare it.

(General)(declarations)

Dim getvalue As Boolean

Dim timesloaded As Integer

Dim valueloaded As String

Private Sub SSDBGrid1_InitColumnProps()

'Add an unbound column; set the bound column to invisible

SSDBGrid1.Columns.Add 0

SSDBGrid1.Columns(1).Visible = False

getvalue = True

End Sub

Private Sub SSDBGrid1_RowLoaded(ByVal Bookmark As Variant)

'First time in get the value of Column's text value

If getvalue = True Then

getvalue = False

valueloaded = SSDBGrid1.Columns(1).Text

Debug.Print "valueloaded" & valueloaded

End If

'Compare the store value with the bound column's text value

'The first time it will be the same and you should load it

If valueloaded = SSDBGrid1.Columns(1).Text Then

timesloaded = timesloaded + 1

Debug.Print "timesloaded" & timesloaded

'Loaded once; don't load it a second time; reset all variables

If timesloaded > 1 Then

SSDBGrid1.Columns(0).Text = ""

valueloaded = ""

timesloaded = 0

getvalue = True

Else

SSDBGrid1.Columns(0).Text = SSDBGrid1.Columns(1).Text

End If

End If

End Sub


DAT1356
How do I have the current row select when I use the up and down arrow keys in the SSDBGrid?

DAT1356

Updated December 17, 1997.

In the RowColChange event, add the current row to the SelBookmarks collection.

SSDBGrid1.Selbookmarks.add SSDBGrid1.Bookmark


DAT1357
When using the SSDBCombo in Visual C++, why will a character typed in the edit portion appear for a second then disappear?

DAT1357

Updated December 17, 1997.

There is a bug in MFC that causes problems if the ListAutoValidate property is set to True (the default value). This is caused by MFC requiring each keystroke to be validated against the list. If the keystroke is not found, the string in the SSDBCombo is reset to it's previous value.

The workaround for this is to set the ListAutoValidate property to False, and if you are using a Remote Data Control, use the Validate event on the MSRDC to handle the validation of the data yourself.


DAT1358
How can I programmatically cause the SSDBDropDown to DropDown within the DataGrid?

DAT1358

Updated December 17, 1997.

You can set the DataGrid's Property DroppedDown to True in the RowColChange event of the DataGrid:

Note	The property DroppedDown is not a property of the SSDBDropdown, but of the SSDBGrid. However it is a property of the SSDBCombo object.

SSDBGrid1.Droppeddown = True


DAT1359
When binding the Data Widgets controls to an ODBC source, why does the load time seem slow?

DAT1359

Updated December 17, 1997.

If you are using the standard VB DataControl to connect via ODBC, be sure that you set:

DefaultCursorType =	"1 - ODBCCursor"

DefaultType =	"1- UseODBC"

Also be sure that the SSDBGrid's UseDefaults = False.


DAT1360
I am writing a VC++ app with Data Widgets and noticed that the C++ wrapper for the controls has no implementation for GotFocus and LostFocus events? Is this an oversight or is there another way to capture these events?

DAT1360

Updated December 17, 1997.

It is not possible to get the GotFocus or the LostFocus events for any OLE control in VC++. However, here is a helpful hint:

The programmer has to declare and implement an MFC message map in the generated wrapper class, to handle the windows messages that he wants, just like he would do them for any other CWnd derived class.


DAT1361
When trying to toggle the Column Object's Style property from Edit to Button in the SSDBGrid's RowColChange event, the Button does not redraw properly.

DAT1361

Updated December 17, 1997.

Place this code in the SSDBGrid's RowColChange event:

Private Sub SSDBGrid1_RowColChange

With SSDBGrid1

If .Row Mod 2 = 0 Then

.Columns(1).Style = ssStyleEdit	'Edit cell

Else

.Columns(1).Style = ssStyleEditButton	'Button

'Put in the following code for a workaround

.Redraw = False

.Columns(1).Width = .Columns(1).Width + 1

.Columns(1).Width = .Columns(1).Width - 1

.Redraw = True

End If

End With

End Sub


DAT1362
When using Visual C++, how can I apply a bitmap to a picture property in a Data Widgets control?

DAT1362

Updated December 17, 1997.

if(lpDispStyle)

{

ISSStyleSet pStyle(lpDispStyle);

//pStyle.SetBackColor(vaColor1);

CPictureHolder picHolder;

picHolder.CreateFromBitmap(IDB_BITMAP2);

VARIANT vtpic;

VariantInit(&vtpic);

vtpic.vt = VT_DISPATCH;

vtpic.pdispVal = picHolder.GetPictureDispatch();

pStyle.SetPicture(vtpic);

}


DAT1363
How would I cancel the update in the BeforeColUpdate event and keep the new value the user has entered?

DAT1363

Updated December 17, 1997.

If you Cancel the Update in the BeforeColUpdate event, the OldValue is placed back into the cell. If you wish to keep the new value the user has entered, you can achieve this in the BeforeRowColChange event.

Private Sub SSDBGrid1_BeforeRowColChange(Cancel As Integer)

If SSDBGrid1.Columns(SSDBGrid1.Col).Text = "Value" Then

Cancel = True

End If

End Sub


DAT1364
How can I set a default value in the addrow of the SSDBGrid programmatically?

DAT1364

Updated December 17, 1997.

You can check the IsAddRow property in either the RowColChange event or the BeforeUpdate event:

If SSDBGrid1.IsAddRow then

SSDBGrid1.Columns(n).value = newvalue

End If


DAT1365
How can I create an Unbound SSDBCombo?

DAT1365

Updated December 17, 1997.

The process is very similar to setting up the Unbound SSDBGrid, only there are a few extra properties that you need to set.

The best way to review this is to open the sample project, EX5UNBND.VBP in the Samples\Chap05 subdirectory. This project demonstrates loading an Unbound SSDBGrid.

1.	Place a SSDBCombo on the form.

2.	Set the SSDBCombo's DataMode to Unbound

3.	Set the DataFieldList property to Column 0; this is very important. Without setting this property the list portion of the SSDBCombo will not dropdown. Also, keep in mind that this property can not be set to a field name in Unbound or AddItem DataModes; you must set it to a Column's internal position - such as "Column 0".

4.	Copy the SSDBGrid's UnboundReadData event's code and paste it into the SSDBCombo's UnboundReadData event.

5.	Place the following code in the Form_Load event:

SSDBCombo1.Columns.RemoveAll

For i = 0 To (ct - 1)

SSDBCombo1.Columns.Add i

SSDBCombo1.Columns(i).Visible = True

SSDBCombo1.Columns(i).Caption = rs.Fields(i).Name

Next i

6.	Congratulations! You have now created an Unbound SSDBCombo - run the project and click on the dropdown arrow and you will see the control's list fill with the RecordSet's values.


DAT1366
Why won't the SSDBCombo's List portion close when I select an item from the list?

DAT1366

Updated December 17, 1997.

Check your DataFieldList property; be sure that you are setting it to a value that the control can recognize. If it is set to a column that it does not recognize it does not know which value to place in the edit portion, therefore, it will not close up.

For bound DataMode, it is case sensitive, be sure that the field name matches EXACTLY as it is returned from the recordset or table.

For Unbound and AddItem DataModes, it must be set to a column's internal position name, not a field name or the Column's Name. For example:

SSDBCombo1.DataFieldList = "Column 0"