YaelS

Hi,

1) Combobox:

I'm working with VS 03, why I can't see "Properties" like here

http://www.codeproject.com/combobox/combobox_tut.asp

I want to add items for a combobox control but the "Data" is in gray color (disable).

And I have to create CMyCombobox object to get the selected item

2) CListCtrl:

How can I set Items like this:

list.InsertItem(row, col, item);

How can I get selected row from this list (in java I used with JTable.. )

3) Date format:

How can I format this string: 02-02-2007 00:00:00 to: 02/03/2007

Thanking you in anticipation

Yael.




Re: Visual C++ General Combobox

TilakGopi

Hi,

1) Combobox:

I'm working with VS 03, why I can't see "Properties" like here

http://www.codeproject.com/combobox/combobox_tut.asp

I want to add items for a combobox control but the "Data" is in gray color (disable).

And I have to create CMyCombobox object to get the selected item

What IDE ur using The sample is built for for VC6.0.

2) CListCtrl:

How can I set Items like this:

list.InsertItem(row, col, item);

Actually row,col are not the terms usually used by CListCtrl.We have Item(just like first column in each row) and subitmes(other columns).

Google is ultimate in providing u lots lots of samples for ur requirement.

3) Date format:

How can I format this string: 02-02-2007 00:00:00 to: 02/03/2007

Let's do it with CString.




CString str(
"02-02-2007 00:00:00");
int nPos = 0;
str = str.Tokenize(_T(
" "),nPos);
str.Replace(_T(
"-"),_T("/"));


Are u done

Thanx,

ch.T.Gopi Kumar.






Re: Visual C++ General Combobox

YaelS

Thank you so motch!!!, sorry, I'm came from JAVA...

my IDE is VS .NET 03 (LOL )

I just don't know why I cant add item to a Combobox "Date". (How can I insert items to this object )

about the string' I's working good now, but I want to change this from 2007/03/02 to 02/03/2007

thank's agein

Yael.






Re: Visual C++ General Combobox

TilakGopi

Hi,

If u would like to add data to combo at the design time itself,go to it's properties,select 'Data' Column,Enter items string like 'one;two;three'.If u run , u will see one,two,three items are added to combo box.

To add strings ,at run time, add member variable for this combo and use either AddString or InsertString methods.

or u can use Win32 SendMessage(LB_ADDSTRING) to add strings to combo box.

about the string' I's working good now, but I want to change this from 2007/03/02 to 02/03/2007

For this following code will convert the date as requested.I don't know,there may be standard functions available.


CString strDate="2007/03/02";

CArray<CString,CString> lst;

int nPos = 0;


lst.Add(strDate.Tokenize(_T("/"),nPos));

while(nPos>0)
{
lst.Add(strDate.Tokenize(_T("/"),nPos));
}
strDate.Empty();
for(int index = lst.GetCount()-1;index>=0;index--)
{
if(((CString)lst[index]).Trim().GetLength() >0)
{
strDate += lst[index];

if(index)strDate +=_T("/");
}
}
lst.RemoveAll();


Thanx,

Ch.T.Gopi Kumar






Re: Visual C++ General Combobox

YaelS

1) If u would like to add data to combo at the design time itself,go to it's properties,select 'Data' Column

Yes' this is what I want, but this Data column is in "disable" status (gray color), so I can write there strings..

the dialog Messages empty, I can' t see the regular look..maybe It's connected to this problem to.

2) I'm thinking maybe it will be better to take this date/time column from the database as date and not as string, then format this something like:

CString strDate;
taskDate;

rs.GetFieldValue("task_date",taskDate);
strDate = taskDate.Format(_T("%d/ %m/ %Y"));


my problem is, How to define taskDate






Re: Visual C++ General Combobox

TilakGopi

1) If u would like to add data to combo at the design time itself,go to it's properties,select 'Data' Column

Yes' this is what I want, but this Data column is in "disable" status (gray color), so I can write there strings..

the dialog Messages empty, I can' t see the regular look..maybe It's connected to this problem to.

It seems that it's problem with IDE or control or control properties.Check control properties once.If the problem is not because of properites,delete that combo, add a new one.If the problem still persists, close the ide,restart.Adding new combo should solve the problem.If not,it indicates that there is some problem with the IDE.

CString strDate;
taskDate;

rs.GetFieldValue("task_date",taskDate);
strDate = taskDate.Format(_T("%d/ %m/ %Y"));


my problem is, How to define taskDate

Please see : http://msdn2.microsoft.com/en-us/library/5f8k59f9(VS.80).aspx

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ General Combobox

YaelS

thanks, with a date I succeed!!!

CDBVariant value;

CTime time(value.m_pdate->year,value.m_pdate->month,value.m_pdate->day,value.m_pdate->hour,value.m_pdate->minute,value.m_pdate->second);

CString sDate = time.Format(_T("%d/%m/%Y"));

I tried all your advice, but it's still don't work.

but it's weird because in another project I have all these. (combobox data & dialog message).

I created a new dialog in my project, add a combo, and I get the data column in disable (and the dialog message is empty panel).

I created new dialog in the "another project " that I coppy with combobox example and the new combobox have the data column, but the dialog don't have message..maybe it's definition topic

sorry about all my questions






Re: Visual C++ General Combobox

TilakGopi

Hey ,

It seems there is problem with ur IDE, try to re-install or contact the vendor.

Cheers,

Ch.T.Gopi Kumar.






Re: Visual C++ General Combobox

Damien Watkins - MSFT

Hello

Re: Combobox

Such questions (VC 2003 or MFC) are outside the scope of this forum - for the scope of the VC General forum please look at: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=19445&SiteID=1

For such issues please use an appropriate newsgroup, potentially one at http://msdn.microsoft.com/newsgroups.

OTP

Thanks

Damien