Connecting Tech Pros Worldwide Help | Site Map
Reply
 
LinkBack Thread Tools Search this Thread
  #1  
Old August 15th, 2008, 10:28 AM
Member
 
Join Date: Nov 2007
Location: South Africa for now...
Age: 30
Posts: 38
Default Problem hiding a COlumn in a datagrid

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
Reply
  #2  
Old August 15th, 2008, 11:36 AM
Member
 
Join Date: Nov 2007
Location: South Africa for now...
Age: 30
Posts: 38
Default

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.
Reply
  #3  
Old August 17th, 2008, 04:31 PM
Member
 
Join Date: Nov 2007
Location: South Africa for now...
Age: 30
Posts: 38
Default

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,
Reply
  #4  
Old August 18th, 2008, 09:17 AM
markmcgookin's Avatar
Moderator
 
Join Date: Dec 2006
Location: Northern Ireland / England
Age: 24
Posts: 496
Default

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?
Reply
  #5  
Old November 12th, 2008, 09:08 AM
Newbie
 
Join Date: Nov 2008
Posts: 1
Default

Hi

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

plz
any help
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.