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

C#-APP: Displaying TAB in a combo box

8
Hi all,
I'm using C#. I have a DataGridView with a ComboBoxColumn. I'm filling the combo box Items collection programatically, because it is different for each row.
Each string in the Items list consists of two other strings, read from a table. I want to format the string, so that the list of items appears as if it has two columns.

When I try the folowing:

Expand|Select|Wrap|Line Numbers
  1. ((DataGridViewComboBoxCell)this.dgvModules.Rows[i].Cells[0]).Items.Add(this.m_tableProducts.Rows[j]["Model"].ToString() + "\t" +       this.m_tableProducts.Rows[j]["Name"].ToString());
a strange symbol like a rectangle appears instead of the tab.

When I try to simply press tab whithin the "", like this:

Expand|Select|Wrap|Line Numbers
  1. ((DataGridViewComboBoxCell)this.dgvModules.Rows[i].Cells[0]).Items.Add(this.m_tableProducts.Rows[j]["Model"].ToString() + "   " +       this.m_tableProducts.Rows[j]["Name"].ToString());
the items does not appear in two columns.

What can I do?

I'm sorry if something is not clear, but English is not my first language.
Jul 30 '08 #1
2 2569
kenobewan
4,871 Expert 4TB
There is a problem with \ & / in c#. Either try "\\t" or @"\t". HTH.
Jul 30 '08 #2
ypytt
8
This simply displays \t in my string.

Maybe I wasn't clear enough. I have two string columns. The first one is with fixed length: 40 characters. I want to construct a third columns containing the two strings separated by some space.
But when I simply add 4 or 5 empty spaces between the two strings, it does'n look good. It is because the different characters in the font I am using have different width (e.g. A and a). Because of that, the first string have a different width on each row, no matter that it is always 40 characters.
When I use the tab button in a word-processing program (e.g. Word), the empty space on each row is different, depending on the width of the first string and the text appears as if it is ordered in 2 columns. I want to do something similar in my application.
I cannot use fixed width font (e.g. Courier), because of user requirements.
Jul 30 '08 #3

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

Similar topics

4
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of...
2
by: Dave N | last post by:
I have a combo box that displays the names of all the users in my "Users" table. I set the RowSource to a Query from the "User" and "Project" tables. I can select any name from the list and that...
10
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions,...
7
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table...
3
by: sparks | last post by:
I have a combo box that when you go to the next combo box it is filtered based on the value in the previous one. so if combo box 1 has fred as its value then combo box 2 has 1 2 3 for values....
4
by: atiq | last post by:
i have used a combo box on a form linked to a query. the user is to select a value from the combo box and this click 'Find'. But on an old occasion where the user has forgotten to select a value from...
33
by: buss123 | last post by:
Hi all, combo box script code was working in IE perfectly with all modes but OnChange event was not working in FireFox(editable mode, if we select valuese that combo box values r...
1
by: sachin | last post by:
Hello Guys.......... Its a nice forum i seen ever on internet.................. And definitly you solve my problem............ I have a multiple combo box and i want to display elements in a...
0
by: Gordon Padwick | last post by:
A form contains controls, one or more of which can be other forms. A form that contains another form is known as a main form. A form contained by a main form is known as a subform. A subform itself...
1
by: Yasmeen Pannu | last post by:
HI, I am new to MS Access and stuck in a problem from few days. My Question: I have 3 combo box (Submitter, date from and date to) on my form and i want that when i select values from each of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.