473,325 Members | 2,860 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,325 software developers and data experts.

Problem hiding a COlumn in a datagrid

62
Hi gang,

Im busy writing my firs Windows Mobile 6 Application. - I'm a beginner ok.

My first problem: When I run the app through the emulator I get an error: Database file cannot be found. - Where does the emulator look for the database? Can I copy the file there?

My connection string when running the app off my actual device is:

this.connectionString = "Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection .Assembly.GetExecutingAssembly().GetName().CodeBas e) + "\\Details.sdf;Persist Security Info=False"); Here it works fine.

If I run the app from the Releaase Folder under the Bin folder it works fine with the following Connection string:

this.connectionString = @"Data Source=Details.sdf;File Mode=Exclusive;Persist Security Info=False";

My second question then is:


I have a data grid which data source is a datatable. the columns are: fldID, fldName, fldSurname and fdlTel.

I want to hide the fldID column. I cannot seem to access the Grid View Property nor set the widths of the columns.

I've tried the following code, but it does not change anything. It also dies not error:

// RENAMING COLUMNS IN A DATAGRID IF DATASET IS USED:
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "tblDetails";

// ID column style
DataGridColumnStyle id = new DataGridTextBoxColumn();
id.MappingName = "ID";
id.Width = 0;
ts.GridColumnStyles.Add(id);

// Name column style
DataGridColumnStyle name = new DataGridTextBoxColumn();
name.MappingName = "Name";
name.Width = this.Width - name.Width - 37;
ts.GridColumnStyles.Add(name);

// Surname column style
DataGridColumnStyle surname = new DataGridTextBoxColumn();
surname.MappingName = "Surname";
surname.Width = this.Width - surname.Width - 37;
ts.GridColumnStyles.Add(surname);

// Tel column style
DataGridColumnStyle tel = new DataGridTextBoxColumn();
tel.MappingName = "Tel";
tel.Width = this.Width - tel.Width - 37;
ts.GridColumnStyles.Add(tel);

dgItems.TableStyles.Add(ts);

Any help please?

Thanks,

Lóan
Aug 15 '08 #1
4 5243
LoanB
62
I solved the first problem:

Use a shared folder (Configure in Emulator) and copy the database file in there.

Still stuck on second issue with hiding columns etc.
Aug 15 '08 #2
LoanB
62
Um, OK, It was not the shard folder as described above. You actually add the database file to the project then the Emulator copies it to a temp folder (I assume as I could not find the folder "ANYWHERE".

Remember this is using unbound controls and hard coding the connection.

I'm till baffled on how to hide a column in a data grid in the .Net 2.0 compact framework. also how to change the captions. The code above runs without error but also without actually doing anything.

Thanks,
Aug 17 '08 #3
markmcgookin
648 Expert 512MB
For the data grid, I would create a dataset from a query on the database, and then simply not select the ID column in the query.

If it looks like the file is missing, have you checked it's properties? On the solution explorer database.sdf file > Properties > Copy always.

Does it work when you deploy it directly to a device? i.e. in the target box select "Pocket PC Device" and not "Pocket PC Emulator" when the PDA is connected.

You say that you "Ran it from the Release Folder" have you built the application in release mode before doing this? I assume you have just copied these files accross to the PDA then run them?
Aug 18 '08 #4
Hi

i'm have the same problem
i can't change column's properties or hide it

plz
any help
Nov 12 '08 #5

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

Similar topics

2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
2
by: Kevin | last post by:
Hi Al Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this TI Kevin
0
by: lanky_tx | last post by:
Hello, I am trying to hide a column in a child table within a windows form DataGrid control. I am populating the Datagrid datasource with an dataset which is populated with hierarchical XML...
1
by: Paulo Gon?alves via .NET 247 | last post by:
My datagrid has a big problem, it happens only in columns that are read only. Please see the picture at http://mega.ist.utl.pt/~pfrg/datagrid/datagrid_problem.jpg The gost that I show it?s like a...
0
by: Michelle Stone | last post by:
I have several Data Adapters, and depending on certain conditions, I set one of them as the DataSource for a datagrid on my web form. In each of the data adapters, I have the primary key of the...
9
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens...
2
by: Federico Caselli | last post by:
I made a form with a datagrid called MyDG. The datagrid has a typed dataset as datasource (MyDS). I put the following code in the load event of the form to hide the id column: ...
5
by: Rich | last post by:
I have a datagrid that uses a dataview object for its datasource. The dataview contains a unique row identifier column. I don't want to display this column in the datagrid. I need the unique row...
1
by: jack | last post by:
Hi all, My datagrid have too many columns which are going out of screen. one of the solution is to group the columns and make only the total column visible at the initial stage. What now i...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.