Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Scrollbar For DataGrid With One Column


Hi,

I have a Sheridan Datagrid (SSDBGrid) with just one column. The column width exceeds the width of the grid to cater for long strings. I therefore need to use the horizontal scrollbar to scroll across the grid to view the entire string within the one column. However, this does not work as the scrollbar scrolls over each column and will only scroll the width of the grid.

I have read a similar thread where this problem was encountered with an MSFlexGrid and a workaround solution was to put the grid inside a PictureBox and use normal scroll bars to control it's position inside the PictureBox.

Has anyone experienced this problem with a Sheridan Grid?

Is there anyway that we can scroll across the grid and view the entire width of just one column ??

Thanks, Ant.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Scrollbar For MSFlexGrid With One Column
Hi,

I have a MSFlexGrid with one column and 100 rows. I put a very long string into a particular row. But I am not able to view the entire string put into the row. The horizontal scroll bars are not enabled. How do we enable the horizontal scroll bar to view the data in the row in the case of MSFlexGrid with one column?

I use the following code.

MSFlexGrid1.Rows = 1000
MSFlexGrid1.ScrollBars = flexScrollBarBoth
MSFlexGrid1.ColWidth(0) = 10000

MSFlexGrid1.AddItem "Required. Integer expression. Numeric expression indicating how many characters to return. If 0, a zero-length string is returned. If greater than or equal to the number of characters in Str, the entire string is returned.
"

Thanks,
Kiran.

How To Move The Cursor From One Column To Next Column In Datagrid
Hi
Everyone,    
    In Datagrid control, how the cursor move from one column to another column of the same row after updating the datagrid.
    plz anyone help me.
    
    thanking you in advance.

Datagrid Scrollbar
Hi,

good day, I would like to ask. Is it possible to move the scrollbar of the grid thru code?

Let me explain further. I have two grids. Lets call them grid1 and grid2. And both of them have a vertical scrollbar when filled with data. I want to browse the data at grid2. So I will use the grid2 scrollbar, but I want grid1 to scroll along whenever the grid2 scrolls down and vice versa. How am i going to achieve this?

Thank you

Datagrid Scrollbar
Hi,

Is there anyway to get the position of a scrollbar on a listview or datagrid?

My problem is that the RowColChange event doesn't fire if you go past the end of the datagrid, so any suggestions much appreciated,

Regards
Ross

Datagrid Scrollbar Mania
I have a datagrid and I have binded a recordset to it. I then make some of the columns invisible.

My problem is that the scrollbar is always longer than the actual table (even when I make all the columns visible).
Can anyone help?

Jagdip

Datagrid Vertical Scrollbar Bug
Hi,

My datagrid which refreshes every 5 seconds is behaving strange...
When i scroll down, the scrollbar is flying to top again....the position of the scrollbar seems to be lost...
The horizontal scrollbar doesnt have this problem.....

Is there an update for the datagrid object or somekind of solution to this problem? is this a known bug?

How To Set Vertical Scrollbar In Datagrid
Hi,
Could you show me how to set the vertical scrollbar visible in a datagrid when the number of records get quite long?

Thanks so much,

ConKi

Subclassing Datagrid Scrollbar Messages
i'd seen the subclassing routine of Randy Birch(VBNet) on Listview Scrollbar Messages (Subclassing Listview Scrollbar Messages) and i find it very interesting i thought i could do it to other controls but unfortunately when i did it to microsoft datagrid(MSdatgrd.ocx) it failed. I need help on this. how to subclass datagrid scrollbar messages?

Disable Datagrid Click Event Yet Enable The Scrollbar
Hi guys,
I am just wondering whether there is a way to disable the click event in datagrid, yet enable the scroll bar by the side??
I have a datagrid listing some inventories, and I have succedded in highlighting certain rows according to the data...
However, if the user click on ANYTHING and ANYWHERE on the grid, the highlighting will disappear...
I tried disabling the grid, but the result is I cannot scroll the grid....
So...
Can someone please help me???
Thanks in advance...

Troubled and tired guy from Taiwan

Add Column To Datagrid
Hi everybody; I hope one of you can help me.

I am displaying a table with a datagrid and want to add a column with the values from another table as it's contents.

Both tables have columns titled CODE. The second table has a field called TYPE that corresponds to the CODE (eg. CODE 101 means TYPE Maintenance). What I want to do is put the values of TYPE from the second table into the datagrid displaying the first table I'm not allowed to add a column into the table being displayed by the datagrid.

I'm connecting to the database thru Adodc (DISA for the first table; CODES for the second table)

I found this but when I try to populate the fields from the second Adodc (CODES) it doesn't work. I figure that's because the Datagrid1 is connected to DISA.

Private Sub AddColumn()
Dim c As Column
Set c = DataGrid1.Columns.Add(DataGrid1.Columns.Count)
With c
.Visible = True
.Width = 1000
.Caption = "type"
.DataField = CODES.Recordset.Fields("CODE").Name

'if i use .DataField = DISA.Recordset.Fields("WHATEVER").Name it
'puts the values from 'WHATEVER' into the column "type"

.Alignment = dbgRight
End With
DataGrid1.ReBind
End Sub

Any ideas?? Thanx in advance.

Set DataGrid.Column Value
Hi,

ive got a Problem with my data grid, i have a DataGrid where the Data Source is an DataEnvironment, allright it works, but now i want do add a column to that grid where i calculate fe: Column1 * Column2 but if i want to insert the value in the column with: DG.Columns(3).Value an error apears:

Column not found, |1

what have i to do to do that???

Column In Datagrid
Hi,
I have a datagrid that bind to a table. Some of the columns of the table are not editable. For those columns in the datagrid, I want to gray them out.
The datagrid property does not give enough tools for me to set up.

Please show me how.

Thank you,

Quang

Datagrid Column
On a form I have a datagrid...how do i specify the column width for each seperate column??

Datagrid Column
I don't want my identity column to show up in my datagrid. How do I control which columns I want visible and which ones I don't?

How To Add Column To Datagrid
Anyone know how to manually add a column to a datagrid.

The default value of the grid when you create the object is to only have two columns, I need 13. Thanks


Nightfox02

Datagrid Column Sum
I have a column in datagrid that displays all the prices. I want to sum up all the values from all the rows of that column and display it as a label. How can I sum up the data??

Thanks ... Bhavesh

Add Column To DataGrid
I am new to working with grids and cannot figure out how to add a column.
The grid is a DataGrid ActiveX Contol - Version 6.0. I can look at the
properties and code but cannot see where to add the column.

I appreciate your help.
Kevin

Add A Column In A Datagrid
I would like to know if it is possible to add a column in a datagrid.
I would like to have a column to describe all line in my datagrid.
By the way, is it possible to display a long text in the header on two line but in the same cell.
For example I have the text "this is my new cell"
And I would like that it display like that:
"this is my
new cell"
because I don't want that my columns have a width of 4000

Thanks in advance

How To Add A New Column Into A Datagrid ?
Hi,

I have a datagrid1 on my screen. I have a recordset myRst contains 3 fields (id, name, age). I set myRst as the datasource for my datagrid.
     set DataGrid1.datasource = myRst

Then I want to add a new column into this datagrid1, which can show info depend on the value of AGE. for example, if age < 12, show 'KID'; if 13 <= age <= 25, show 'Tenage'....
        
        DataGrid1.Columns.Add (3)
        DataGrid1.Columns(3).Width = 350
        DataGrid1.Refresh

Now i want to populate this new column using following code:

myRst.movefirst
do while myrst.eof = false
    with datagrid1
        if .columns(2).value < 12 then
            .columns(3).value = "kid"
        ......
        end if
    end with
    myrst.movenext
loop

When i ran the program, first 3 columns populuated successfully, but last column is empty, and I got following error:
        Column not found, /1

What does this mean?

 
Grace

How To Get The Column Name Of Datagrid
Is there anyone know how to get the number of columns and its corresponding name of datagrid and put it in list box or variable.

Or there's another option except datagrid which get the field name of a table.

Note: I only knew the name of the table but i dont know its field name.


Thank you very much for your reply.

Datagrid Column Sum
I am trying to find a way to sum the values of a column in my datagrid. I have not even found a way to isolate a single cell, row coordinate. Please help.

Datagrid Column Sum
I have a column in datagrid that displays all the prices. I want to sum up all the values from all the rows of that column and display it as a label. How can I sum up the data??

Thanks ... Bhavesh

Datagrid Column Sum
I have a column in datagrid that displays all the prices. I want to sum up all the values from all the rows of that column and display it as a label. How can I sum up the data??

Thanks ... Bhavesh

How Can I Get The Column Name Of The Datagrid
I want to get the name of the column when I double-click that column in a datagird control
how can i do it?
Thank u

DataGrid Column Width Value?
In this expression...

DataGrid.Columns.Item(iCol).Width = 1000

What type is '1000'?
Is it a Pixel, char...number.....etc....i cant figure it out......

the reason for this is I have a MSflex grid which has a column width of 20...i would like to know how to convert that number to the equiv in a datagrid..Please any help would be great. Thanks in advance

DataGrid Column Width Value
What is the Column Width Value Type.....ie... Pixels, Spaces, Points? etc...

Datagrid Column Control
I want to remove the column in my datagrid that shows the ID. How do you control which columns are visible?

Datagrid Column Width ????
I have two datagrids that are exactly the same. The only difference is that I am using them on different forms, and one of them has a filter.

My question is this.
On the first datagrid, I could write column widths like this
AppointmentsDataGrid.Columns("time").Width = 40
AppointmentsDataGrid.Columns("patient").Width = 150
AppointmentsDataGrid.Columns("Doctor").Width = 150
AppointmentsDataGrid.Columns("status").Width = 50
and the output was as I expected.

but then, on the second grid, when I write the same thing, the column widths get rediculously small. Is there a way of specifying the units used for the column widths that I have missed?

Jagdip

DataGrid - Format Of One Column
Set grdStock.DataSource = Adodc1
grdStock.Refresh
grdStock.Columns(0).Width = 900
grdStock.Columns(1).Width = 1700
grdStock.Columns(2).Width = 1700
grdStock.Columns(3).Width = 1700
grdStock.Columns(4).Width = 1700
rdStock.Columns(4).DataFormat = FormatCurrency(Price)

So I want to make column(4) with Format Currency. I tried this but does not work. Does anybody have idea how I can make this format in DataGrid?

Thanks,

Ilimax

Datagrid Column Question
I have a datagrid and would like all the cells in the first column to be "RECEIVE".
I've tried

DataGrid1.columns(0).text = "RECEIVE"

AND

DataGrid1.columns(0).value = "RECEIVE"

Neither worked

I was reading something about the DefaultValue property in my vb book that seems would work for my problem but ofcourse it has no examples. I also looked it up on the MSDN and it talks about using a Tag property, which I dont know how to use.

Datagrid Column Widths
I am using a datgrid, and looking for a way to "autosize" the column widths. Is this possible, or do I need to know the lenth of my data in order to set the column width?

Thanks

Setfocus To Datagrid Column
How can I set focus to a specific column in a datagrid

Datagrid Setfocus To Column
How can I set focus to a specific column in a datagrid.

How To Set Datagrid Column To Uneditable
Hi. I have a form contains a datagrid (with 2 fields/columns: ID, UserName) and two command buttons ("Add", "View All"). When user clicks on "View All" button, the datagrid will display all the user information (ID 1 to 10) with the "ID" column/field is NOT editable. When the user clicks on the "Add" button, a new row (ID = 11) will be APPENDED as the last row in the current datagrid. In this case, user can add or modify this NEW appended Row (which mean ONLY the row with ID =11 is set to editable) while ID =1 to 10 is NOT editable also. I have use the following methods to make the new row(ID = 11) to editable but to no avail.

Any suggestion is truly appreciated.


Code:
'at form load
datagrid.column(0).locked = true

'when user clicks Add button
datagrid.CurrentCellModified = True
datagrid.EditActive = True

Datagrid Column Question???
Hi Guys,

I have a datagrid which has 5 column only and more than 500 rows. Now I want to Update only 4 th column I wrote update sql statement, but after updating the data I want to refresh only updated Row (other row should remain the same ) and cursor should go to next row on 4th column. Can anybody help me with this???

This is very urgent. please help me.........

Thanks in advance,
Ekta

Datagrid Column Sizing
I am trying to size the columns of a datagrid in VB6. I have placed a datagrid on a form and use

set r=new ador.recordset 'create disconected recordset

and

r.fields.append "col name", adVarChar, 500

to append columns.

There are currently 16 columns i use and no matter how i try i cannot get the columns to the size i want, each column needs to be a width that i specify. All columns seem to be of a size that i cannot determin the source of, its not the defCol widths or any value i can see any where else.

Any suggestions would be very much appreciated.

Datagrid Column Header
Hi all,
the text I have in my column header for my datagrid is too wide for the column width I am allowed. I have used vbCrlf to wrap the text but then I cannot see the second line in the column header row. Is there a way of setting the height of the column header row? Or alternatively is there a better solution to my problem? Any help would be greatly appreciated.

DataGrid Column Format
I want to format DataGrid column (type boolean) to display
'OK' for value 'True' and 'WRONG' for value 'False'.
DataSource is set in run-time mode as:

With DataGrid1
Set .DataSource=rst
End With

I can't format column in design-mode because there is no
column numer in Custom dialog for DataGrid1 properties.

Assign A Value To A Column In A Datagrid
This should really be easy.

I have a datagrid bound to a datasource. One of the column in the datagrid is not bound to a column in the datagrid.

I would like to assign a value, or be able to edit that column like so : grdDataGrid.Columns(3).Text = "Please Work"

Please see attached project (install in c: est1n).

Click on command1 to reproduce problem.

How To Add A Combobox For A Column In A Datagrid
Hi there..
How to add a combobox for a column in a datagrid or dbgrid ..for example in the access tables you can have a pull down list/menu..

The way i add a combobox for a datagrid or dbgrid is to add a separate combobox to the form....

if dbgrid/datagrid has column named product id, when the the user clicks on the column the combobox .left and .height and .top is set to the values of the datagrid.

what it does is it positions the combo box on top of the column in the datagrid.. unfortunately this is not a very easy way of doing..and it does not look good..

is there any other way for me to add a combo box to the datagrid.. doesnt the datagrid/dbgrid has a built in sort of combobox..

Thanking you guys in advance for helpig out..

regards pragash..

Column Lock In Datagrid
is there a way to disable columns at run time in a data grid based on a recordset. i need to build a grid where different departement can view all the grid but can only write in some column depending on the departement.

thanks for any advice


I'll be among the best soon, very soon!!!

Datagrid Column Titles
Ok... I have a datagrid that is attached to an ado control... is there a way of changing column titles after I've sent a query to the ado?

Tag/boolean Column In Datagrid
Can someone show me a sleek way to set a tag/boolean column in the datagrid. I want to accomplish the same task a checkbox would have: the user selects certain records (by putting 1 into the Tag column) and then a new table is created from those records chosen.

The way I have it now partially works. This is my code.

'puts the records user selected into new table
ACCESSdb.Execute "SELECT * INTO [Chosen] FROM [Type] Where Tag = '1' "

ACCESSdb.Execute "UPDATE Type SET TAG = '' where Tag <> ''"
'this resets all the Tags back to nothing

With rsFLEETS2
.ActiveConnection = cn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open "SELECT * FROM Chosens ORDER BY TYPE ASC"
Print .RecordCount
End With

Set Adodc2.Recordset = rsFLEETS2

This works, IF the user changes the value to 1 and moves off that record. I guess the grid needs that to refresh. If the user changes the Tag to 1 and clicks on Select right away (without moving off the record), it won't return anything.

Does anyone have any idea who I should be doing this?

Summing Up The Column Of A Datagrid
Hi again, this is my recent post since July.

Anyway I have a stupid question to ask:

I have a datagrid populated by a dataset (which was filled by a dataadapter) and I want to know how do I sum up the values in a column (column no. 2 for instance) of the datagrid with a non-fixed number of rows and put the results in a variable for instance. Its that simple, the datagrid is read-only so I dont have to update the data grid, its just the adapter filling up the values from time to time.

I have just learned by browsing that it is not possible to run SQL commands into a dataset and it follows a datagrid. is this true?

I have searched this site for answers but it seems i cannot find the correct thread. Please somebody help me with my problem.

Datagrid DropDownList Column
Hi,

I'm populating a Datagrid with database values. I have an Edit button column, and what I want to achieve, is that after it's clicked, one of other columns' fields is shown as a Dropdownlist (instead of a Textbox). The values defined in the Dropdownlist do not correspond to any values from the database (they should be fixed values).

I've searched through the web, but I don'y know how to bind such List to one of the columns after the edit button has been clicked. I know this will have something to do with a Datagrid Template Column and Datagrid ItemDataBound event, but I can't seem to work it out.

Can you please help me?

How To Resize A Column In A DataGrid
I need help again, how can i resize a column in a DataGrid, i know that in the MSHFlexiGrid i can do it with

Code:
MSHFlexiGrid1.ColWidth(index) = 'a number
but there is not such property for a DataGrid.

Resizing Column In Datagrid
how do you resize a column of a datagrid to match the length of the text in it? and is it possible to change the style of the header to bold? thanks

Third Column Of A DataGrid To Show The Value Of ....
Dear Friends,

I am using MS Access Database. The following are the complete details:

Table: Balance

Fields: 1) Received
2) Sold

DataGrid: dbgBalance

CommandButton: cmdShow_Balance

I have three columns in the DataGrid. First column to show the value of “Received” field, the Second column to show the value of “Sold” field and the Third column to show the balance for which there is no field in the table.

So, what I need now is, the Third column should get the value from “Received” field and deduct the value of “Sold” from it and then show the resulted value in DataGrid Column “Balance”.

So, each row in a DataGrid will show the values like this:

1st Row : 5000 – 2000 =3000
2nd Row : 7000 – 6000=1000
3rd Row : ………………….
4th Row : …………………..
…………………………….

And so on ….

How can I do this? Please do help.

Regards,

Margaret

Get Column Headers In Datagrid
Hi all!

I would like to ask if anyone knows how to get the names of the column
headers from a datagrid?
My grid is populated at run from an excel file. So the column names are not defined at design time.

Please help.

Copyright © 2005-08 www.BigResource.com, All rights reserved