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

Change datagrid Column Value

This is my code

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.     Set rs = New ADODB.Recordset
  4.     rs.Open "SELECT id,name,address,male FROM members", cn, 1, 3, 1
  5.     Set grdData.DataSource = rs
It's okey but now the column "Male" just show -1 and 0
I want this column will display "Male" or "Female"

I tried this
Expand|Select|Wrap|Line Numbers
  1. If rs.Fields("male")=Yes Then
  2. grdData.Columns("male").Text   = "Male"
  3. Else
  4. grdData.Columns("male").Text   = "Female"
  5. End If
But it don't work..
Aug 1 '08 #1
1 4008
MikeTheBike
639 Expert 512MB
This is my code

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.     Set rs = New ADODB.Recordset
  4.     rs.Open "SELECT id,name,address,male FROM members", cn, 1, 3, 1
  5.     Set grdData.DataSource = rs
It's okey but now the column "Male" just show -1 and 0
I want this column will display "Male" or "Female"

I tried this
Expand|Select|Wrap|Line Numbers
  1. If rs.Fields("male")=Yes Then
  2. grdData.Columns("male").Text   = "Male"
  3. Else
  4. grdData.Columns("male").Text   = "Female"
  5. End If
But it don't work..
Hi

On the basis that 'male' is a Yes/No field the I suggest this
Expand|Select|Wrap|Line Numbers
  1. If rs.Fields("male") Then
  2.     grdData.Columns("male").Text   = "Male"
  3. Else
  4.     grdData.Columns("male").Text   = "Female"
  5. End 
on the basis that it is True or False.

I always think Yes/No is a stupid name for what is realy a boolean variable/field.


MTB
Aug 1 '08 #2

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

Similar topics

3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
0
by: Amber | last post by:
There are times when you will need to highlight or otherwise modify the contents of a particular DataGrid row-column value based upon the value in the column. In this example we will select the...
0
by: Dan Hartshorn | last post by:
VS.NET 2003, C#, Windows Server 2003. I have a datagrid and I want the last column to be either an EditCommandColumn or a template column, depending on a value I have. The value changes for each...
4
by: Rob Kroese | last post by:
I've got a form with a datagrid that displays a list of items, along with several textboxes, comboboxes, etc., that display the details for the selected item. The columns in the datagrid and the...
5
by: HS1 | last post by:
Hello I have a datagrid to show data for a database table using "seclect * from tablename" The datagrid works OK. However, I want to change the name of the fields in the database to other...
4
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to...
2
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's...
2
by: Billy | last post by:
Change DataGrid EditControl On Data Value Hi, I have a datagrid, and on editing, I want to change the control in the third colunm based on the value of the first column. The value in the...
0
by: satish | last post by:
I have a table with two columns field1 int,Field2 and added a column to datagrid on runtime sum (field1+field2) ,upon changing the data in either of the fileds the sum field or column too changes ....
1
by: satish | last post by:
I have a table with two columns field1 int,Field2 and added a column to datagrid on runtime sum (field1+field2) ,upon changing the data in either of the fileds the sum field or column too changes ....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.