VS 2003 datagrid question

adshocker

Well-known member
Joined
Jun 30, 2007
Messages
180
Programming Experience
Beginner
hi all,

is it possible to have a bound and an unbound columns in one datagrid in VS 2003?
 
another datagrid question

hi all,

i was already informed that datagrid in VB 2003 cannot have both bound and unbound columns but i was wondering if there's another way to do this..

i have 2 columns quiz1 and quiz2, then another column for average. in my database table i only have fields for quiz1 and quiz2.
what i want to do on my datagrid is to have 1 column each for quiz1 and quiz2 then a third column which computes the average for both.

is this possible in the current situation? or if you can suggest any other approach to this.

thanks.
 
create a new column in the underlying datatable, and use the .Expression property to calc the average. for more info on Expression, read in mSDN
 
create a new column in the underlying datatable, and use the .Expression property to calc the average. for more info on Expression, read in mSDN

the .expression property seems to be very handy. too bad it doesnt support sql query statements. =)
thanks so much.
 
Last edited:
the .expression property seems to be very handy. too bad it doesnt support sql query statements. =)
thanks so much.

Er.. Youre right. It doesnt. That's what SQL is for!

Expression is for simple stuff like.. er.. units * price = TotalCost, or FirstName + ' ' + LastName = FullName

FOr complex stuff, do it in SQL:

VB.NET:
SELECT
 a.*
  Round(a.EndTime - a.StartTime, 2) - 1 as HoursWorkedMinusLunch
FROM
 tblTimeSheet a
 
Back
Top