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.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
How To Format A Column In A Datagrid?
I have a datagrid that I define in code. The code looks like this:
'For colums in dgdDonHist
Dim colDonHistAcctNum As Column
Dim colDonYear As Column
Dim colDonAmt As Column
Dim colDonPostDate As Column
'Sets data source for dgdDonHist
Set dgdDonHist.DataSource = rsDonHist
'Sets columns to dgdSubHist's columns
Set colDonHistAcctNum = dgdDonHist.Columns(0)
Set colDonYear = dgdDonHist.Columns(1)
Set colDonAmt = dgdDonHist.Columns(2)
Set colDonPostDate = dgdDonHist.Columns(3)
'Changes captions
colDonYear.Caption = "Year"
colDonAmt.Caption = "Amount"
colDonPostDate.Caption = "Post Date"
'Changes column widths
colDonYear.Width = 705
colDonAmt.Width = 1200
colDonPostDate.Width = 1005
I want to format the colDonAmt column (Columns(2)) to display a currecy value. Does anyone know how I can accomplish this?
Thank you in advance for any advice.
Timoteo
Format Datagrid Column Programatically
Can someone please tell me how to format a column in a Datagrid through programming? I have a currency field in my table and want that to be reflected in the Datagrid.
How To Format Column In Datagrid In Code
i have a datagrid which gets its contents from an adodc, i wish to format one of its columns which contains numbers so that it would have commas. ex 1000 -> 1,000
How To Format A Column Which Holds Date In Datagrid.
A good day to you.
I want to format Column that shows Date in Datagrid as DD/MM/YY but the default format is MM/DD/YYYY. I can set it in MS Access but Datagrid shows different. I tried to set it up in Datagrid Properties but still shows the MM/DD/YYYY format. I have 20 Columns and two columns will be for date and thousands of records that Datagrid will show.
Any help will be highly appreciated.
*RESOLVED* Numeric Format Of Datagrid Column
Hi All,
I'm trying to format a column in a datagrid like so:
VB Code:
DataGrid1.Columns(1).NumberFormat = "###,###,###.00"Set DataGrid1.DataSource = ctyplotcon.Execute("pp_MonthlyChargeTotal")
There are two columns in this grid, and the second is the result of a sum operation on a database (MSSQL). I've tried holdfields and rebind, with no luck. I'm seeing values like:
17514.1
125
467.25
What am I doing wrong or not doing?
A Date Format Mask In A Datagrid Column
Hello,
I am a beginner programmer using VB6. I want to apply a date format mask to a column in a datagrid control. Is this possible? I tried the dataformat property and a stddataformat object with no luck. Help!! Code snippets appreciated.
Many thanks,
Trimtrom
How To Set A DataGrid Column Format To &"checkbox&" At Run-time.
I would like to configure my VB6 datagrid at run-time.
At design-time, you can say that the column X is checkbox format.
At run-time, my datagrid change with another recordset --> no format.
How can I say, by code (at run-tim thus), that the column X is a checkbox?
Datagrid - How To Format A Column As &"%&" - VB6
Hello --
Our user wants a column in the DataGrid formatted as "%", so that he sees
"nn.n%" instead of ".nnn".
I have seen mention of StdDataFormat, as in
Dim fmtPct1 As New StdDataFormat
but I don't know to create the text for fmtPct1, nor do I know how to use it
in an expression.
Can anyone tell me how to format a DataGrid column to appear as I describe?
Thanks for any help.
L Mehl
Format A Column
I want to format cells from B2 to end of B column to 'Text'.
How can I write vb code to do this?
Thank you.
Changing Column Format
Dear Group,
I need for the whole column in .csv file to move fron 4 characters in front (Mid(Laura, 5) & Left(Laura, 4)). How do I select the enilre column ? Or do I have to first do it on the top cell and then copy the existing format to the rest?
Dim Laura
Columns("I:I").Select
Selection.Insert Shift:=xlToRight
Columns("J:J").Select
Selection.Copy
Columns("I:I").Select
ActiveSheet.Paste
Range("I1").Select
Laura = Range("I1").Value
Laura = Mid(Laura, 5) & Left(Laura, 4)
'MsgBox (Laura)
Selection.Copy
Range("I2:I2039").Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Format Column Not Working
I have the following code which creates a new table in access, and then assigns dates to a column in that table (the dates are stored in an array).
If i print the array the dates look fine, however when i insert them into the table they appear as minutes, and if i convert them to another date format
they are the wrong date. Any ideas?
The line where the proble occurs is:
' Create Table
myConnect.Execute "CREATE TABLE Mark_Test (Week_Commencing date);"
All the code:
Private Sub Form_Load()
Dim myConnect As New ADODB.Connection
Dim i As Integer
' Connect to database
myConnect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesMicrosoft Visual StudioVB98AdcumePrint Accumulation.mdb;Persist Security Info=False"
' Open Connection
myConnect.Open
' if Table exists delete it
On Error Resume Next
myConnect.Execute "DROP TABLE Mark_Test"
' Create Table
myConnect.Execute "CREATE TABLE Mark_Test (Week_Commencing date);"
' Insert Dates into table
For i = 1 To UBound(myDates)
myConnect.Execute "INSERT INTO Mark_Test Values (" & (myDates(i)) & ");"
Next i
End Sub
VBA - Excel Column Format
In Excel sheet
Select Column--> Right Click --> Format Cell --> Text
This will make the column as text field column, so that we can enter alpha numeric values (eg:0001123).
Is it possible to do from visual basic code to set the column property.
Please do reply @ you earliest possible time
Thanks In Adv
Excel Column Format
I am writting an application that reads in excel worksheets to access tables in VB. Unfortunately there are some special types in excel that do not translate to access and some of the data in the worksheet becomes distorted.
I had the idea of opening up the excel worksheet from VB6 prior to transfer and checking the columns for the special types but I can't seem to figure out how to check the columns for their data type... anybody know how to do this?
MSHFlexGrid Column Format
Hi Guys
How would one format columns in MSHFlexGrid?
I have tried various way's but without luck.
Col3=currency
col4=dd/mm/yyy
Thanks
Pieter
Edited by - pieterw0 on 2/6/2005 10:20:19 AM
Format Excel Column
hi guys
How to format excel sheet column from visual basic.....
Like Excel Sheet -> Select Column -> Format Cell -> Text
This makes the column to text format .....
is this possible from visual basic
Thanks In Adv
How To Format Column After Filtering
The discription may be lengthy, the solution may be simple?
I want to filter an access database in vb. I defined two controls in form1.frm (forms): Grid1 as MSHFlexGrid, and filterCtl as ADOFilter. I wrote a function called applyformats in form1. It looks like this
Public Sub ApplyFormats() ...
Set formats = New Collection
formats.add "#,##0.00", "Balance" ...
with Grid1 ...
header = .ColHeaderCaption(I, x) ...
vFormat = CStr(formats(header)) ...
.TextMatrix(row, currentCol = _
Format(CDbl(.TextMatrix(row, currentCol)), vFormat) ...
end with ...
Also in form1, I wrote a sub: Private sub form_paint(), which calls SetGridLook. Another sub: Private sub SetGridLook() calls Applyformats. In form1_load, I wrote filterCtl.SQLString = "SELECT * FROM ATB", where ATB is a table within an access file db1.mdb.
In ADOFilter.ctl (user controls), I defined several combo boxes for filter criteria and cmbRunFilter as commandbox. I wrote a Private Sub UserControl_show() that calls GetRecords, while in Private Sub GetRecords(), I Set myRecordSet = odb.GetRecords("Select * FROM db1"), where myRecordSet is defined as: Private myRecordSet As New ADODB.RecordSet. I then put a filter criteria string in cmbRunFilter_click, and wrote myRecord.filter= FilterCriteria.
When I run the program, I first get a formatted "Balance" column. But this column becomes unformatted after I select the filter criteria and click RunFilter commandbox for filtering, something like 190.200000003. I then place a breakpoint on myRecord.filter=FilterCriteria. The program stops at the breakpoint. I then press F5 to continue. Now I get the formatted "Balance" column! I tried putting form1.applyformats below myRecord.filter=FilterCriteria, but it doesn't help. It appears that there are differences between break mode and run mode. But this breakpoint is not in a MouseMove event procedure or in a Timer event. I spent a few days and couldn't figure out why.
Your kind help will be highly appreciated.
-Gezai
Datagrid1 (Column Format)
Hello:
I want to thank all that reply.
I have set up a Datagrid and have got most of my formatting complete, however I can't seem to figure out how to make my columns display a (Yes for True / No for False) I need to be able to do this with code.
( I would really like to display a checkbox with a (Checkmark for True / Unchecked for False) but I don't know if the Datagrid can do that or not.
I have to be able to do any of the above with code not through the property box.
I am connecting to an .MDB database which has the columns set with a checkbox (Checked=True / Unchecked=False).
Thanks for all you help.
Word VBA: Apply Format To A Column
Hi to all
I am using Word VBA and Visual, and i have a doubt.
I want to create a table and apply a format to a column, but the column object has no the range element, so I can't do this something like this
Code:
MyTable.Columns(1).Range.Bold = True
so, it's possible to apply a format (bold, allignment, ...) to a certain column using VBA code?
thanks to all
Data Grid Column Format
HI.....
I have a data grid to display all the data in the Access database where the user can edit these data. One of the fields in the Access database is in the Yes/No format, meaning it contains a checkbox.
My problem is...when the data from the database are displayed in the data grid the column that is suppose to have the checkbox is displayed as "0" for the unticked checkbox and "1" for the "ticked" checkbox....
What i need is for the column to display the checkbox so that the user can tick on the data they desired.....
1. can i somehow...set the format for that particular column of the data grid so that it can display the checkbox?
2.can i locked only those columns that cannot be edited by the user?
please help
RichText Box Column Format In Word
Hi All,
I'm facing a problem... I wanted to load a word rtf file with table columns.
But It when it loads,table coulmns are not visible ...
Help me...
And Is there any other controls similar to ricktext box to load a rtf file with coulmnn features.
Cheers
xBox
Format The Second Column In A Csv File For Text
im using the following code to output the details of a text file to a CSV file:
VB Code:
Dim file_name As String Label5.Caption = (Label5.Caption + ".csv")file_name = Label5.Caption Open "D: emp" & file_name For Output As #1Print #1, Text2.TextClose #1
The problem is that there is a row of numbers 13 characters long, when it gets sent to the CSV file it shortens it to something like this:
5e+12
Is there a way to format the ccolumns for text just before the data is sent to it.
Thanks
MSHFlexGrid Format A Column As Currency
I am just starting to use the MSHFlexGrid I'm used to the standard DataGrid so it was no problem formatting columns as currency so they showed as an example $4500.00. I'm trying to do the same with the MSHFlexGrid but it shows just 4500 not $4500.00. The db is Access and those fields are set to currency and the default is $0.00 in the db anyone know how to fix it??
Sorry I'm just stupid when it comes to the MSHFlexGrid.
Data Grid Column Format
On the format tab of the Propery Pages for MS Data Grid when selecting format type "CheckBox' it is explicitly said in the description: "This format allows a check box to be set properly when bound to a bollean column"
In the SQL Server 7 there is no ability to set boolean data type to the column, so to avoid this problem I do next steps:
Dim i As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim rs1 As ADODB.Recordset
Set rs1 = New ADODB.Recordset
Dim fmtBooleanData As StdDataFormat
Set rs = clsSearch.GetPaymentInfoTest(2, clsSecurity.cn)
Set rs1 = New ADODB.Recordset
rs1.Fields.Append "Field1", adBSTR, 64
rs1.Fields.Append "Field2", adBSTR, 64
rs1.Fields.Append "Field3", adBSTR, 64
rs1.Fields.Append "Field4", adBSTR, 64
rs1.Fields.Append "Field5", adBSTR, 64
rs1.Fields.Append "BooleanField", adBoolean
rs1.Open
For i = 0 To rs.RecordCount - 1
rs1.AddNew
rs1.Fields("Field1").Value = rs!anyfield
rs1.Fields("Field2").Value = rs!anyfield
rs1.Fields("Field3").Value = rs!anyfield
rs1.Fields("Field4").Value = rs!anyfield
rs1.Fields("Field5").Value = rs!anyfield
rs1.Fields("BooleanField").Value = False
rs1.Update
rs.MoveNext
Next i
Set DataGrid1.DataSource = rs1
The above is basically means that I assign a boolean field to column# 5. It's formated as a check box. Why when I run an application it does not displayed properly. It actually display 0 -for false, 1 -for true
And if all of the above is wrong, what grid control I can use that has this ability to set up one of the column as a check box. I do not want flex grid since it is a read only and I need user to be able to add and remove data.
Thanks in advance to whoever answers the question.
Data Grid Column Format
HI.....
I have a data grid to display all the data in the Access database where the user can edit these data. One of the fields in the Access database is in the Yes/No format, meaning it contains a checkbox.
My problem is...when the data from the database are displayed in the data grid the column that is suppose to have the checkbox is displayed as "0" for the unticked checkbox and "1" for the "ticked" checkbox....
What i need is for the column to display the checkbox so that the user can tick on the data they desired.....
1. can i somehow...set the format for that particular column of the
data grid so that it can display the checkbox
2.can i locked only those some columns that cannot be edited by
the user?
please help
Set The Column Format In A EXCEL SpreadSheet
Hi,
I was wondering if anybody knew how to set a columns data type in EXCEL to a date format. My table has a date field and when I create the spreadsheet from VB, the date field comes up as a bunch of numbers. I can't figure out the syntax to set the field to a date format from VB. Thanks in advance.....
How To Arrange Data In Column Format
friends
how can i arrange make data appear in column
such that first column is filled first then
instead of going to next page
control start printing in next column in tghe same page
urgent
please help
Excel Cell/Column Format
Hi Friends,
How can i change/set the column format thru VB.
I want to set date format to one of the column while transfering data from flexigrid control to excel file.
Thanks.
Format An Entire Excel Column
Does anyone know how to programatically format an entire Excel column in VB? I need to format a date column from m/d/yy to mm/dd/yyyy.
1/1/01 --> 01/01/2001
11/15/01 --> 11/15/2001
Thanks again!
No L c
VB Developer
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
|