473,385 Members | 1,474 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,385 software developers and data experts.

Please help me with my ssdbGrid problem

Hi, i have a problem with my ssdbgrid in vb6. the task is to find and highlight selected row in the grid.. . . Is there anyone can help me with this problem?..
my code below is to select the specfic records or row but the problem is, my code cannot highlight the row..How can i?Please help me i need it badly...


i = 0
ssdg1.MoveFirst
For i = 1 To ssdg1.Rows

If ssdg1.Columns("Description").Text = frmDailyActivities.ssdg.Columns "Activity Code").Text Then

ssdg1.SelBookmarks.Add ssdg1.RowBookmark(i)
Exit For
End If
ssdg1.MoveNext

Next i
Nov 3 '08 #1
2 5389
Dököll
2,364 Expert 2GB
Hey there Good buddy!

Why not give this one a whirl:

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3.       Dim cn As New ADODB.Connection
  4.       Dim rs As New ADODB.Recordset
  5.       Dim cmd As New ADODB.Command
  6.       Dim i As Integer
  7.       Dim FindLastName As String
  8.  
  9.       Private Sub Command1_Click()
  10.  
  11.          ' Remove previously saved bookmark from collection
  12.          If (DataGrid1.SelBookmarks.Count <> 0) Then
  13.             DataGrid1.SelBookmarks.Remove 0
  14.          End If
  15.  
  16.          ' Prompt user for desired author's last name
  17.          FindLastName = InputBox("Please enter the author's last name you
  18.                                   want to search for", "Find")
  19.  
  20.          rs.Find "au_lname = '" & FindLastName & "'", , , 1
  21.  
  22.          ' Append your bookmark to the collection of selected rows
  23.          DataGrid1.SelBookmarks.Add rs.Bookmark
  24.  
  25.       End Sub
  26.  
  27.       Private Sub Form_Load()
  28.  
  29.          ' Open your ADO connection where "Pubs" is an ODBC DSN that
  30.          ' points to pubs database in SQL Server
  31.          cn.Open "Pubs"
  32.  
  33.          ' Create your command to query for all records in Authors table
  34.          With cmd
  35.             .ActiveConnection = cn
  36.             .CommandText = "select * from authors"
  37.          End With
  38.  
  39.          ' Open your recordset
  40.          With rs
  41.             ' Set rs properties
  42.             .CursorType = adOpenKeyset
  43.             .LockType = adLockOptimistic
  44.  
  45.             ' Call open using active command
  46.             .Open cmd
  47.          End With
  48.  
  49.          ' Populate the DataGrid providing rs as the data source
  50.          Set DataGrid1.DataSource = rs
  51.  
  52.       End Sub
  53.  
http://support.microsoft.com/kb/195472

See if that works!
Nov 11 '08 #2
Thanks Dokoll, I've got the problem with my code..when i change the syntax of the bookmark the problem was solved.. thank you very much for helping..
more power..
Nov 18 '08 #3

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

Similar topics

21
by: Applebrownbetty | last post by:
Hi, I've run into a problem with IE 6 vs. Mozilla when displaying a completely CSS positioned page, and was wondering if any resident CSS guru might quickly be able to find the problem(s). Thank...
0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
2
by: Carlo, MCP | last post by:
Hi, Sorry for posting twice, but I hope in your comprehension. Please help me! I'm troubling from months with a serious serialization problem that I'm not able to solve. I try to describe as...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
by: oldgent | last post by:
I am having a problem installing the starter kits. I have reinstalled VS 2005, think that might be the problem. I then installed both 'Personal Website" and the "Club Website" starter kits. I...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
2
by: violeta123 | last post by:
I am stuck! Please help It might be difficult to explain the problem via email, but I will try. I have a Win 2003 Enterprise server running with the only purpose of a membership web site...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.