473,561 Members | 3,336 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem hiding a COlumn in a datagrid

62 New Member
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.connection String = "Data Source=" + (System.IO.Path .GetDirectoryNa me(System.Refle ction.Assembly. GetExecutingAss embly().GetName ().CodeBase) + "\\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.connection String = @"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:

DataGridTableSt yle ts = new DataGridTableSt yle();
ts.MappingName = "tblDetails ";

// ID column style
DataGridColumnS tyle id = new DataGridTextBox Column();
id.MappingName = "ID";
id.Width = 0;
ts.GridColumnSt yles.Add(id);

// Name column style
DataGridColumnS tyle name = new DataGridTextBox Column();
name.MappingNam e = "Name";
name.Width = this.Width - name.Width - 37;
ts.GridColumnSt yles.Add(name);

// Surname column style
DataGridColumnS tyle surname = new DataGridTextBox Column();
surname.Mapping Name = "Surname";
surname.Width = this.Width - surname.Width - 37;
ts.GridColumnSt yles.Add(surnam e);

// Tel column style
DataGridColumnS tyle tel = new DataGridTextBox Column();
tel.MappingName = "Tel";
tel.Width = this.Width - tel.Width - 37;
ts.GridColumnSt yles.Add(tel);

dgItems.TableSt yles.Add(ts);

Any help please?


Aug 15 '08 #1
4 5255
62 New Member
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
62 New Member
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.

Aug 17 '08 #3
648 Recognized Expert Contributor
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
1 New Member

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

any help
Nov 12 '08 #5

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

Similar topics

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 (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's...
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
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 only 2 levels deep. XML: <Customers id="123" name="Joe" level="A">
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 new readonly textbox. If the selected cell it?s not readonly there?s no problem. I think that the problem it?s ralated with lose of focus of the...
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 respective tables SELECTed in the select-queries, so that I may use that field as the DataKeyField of my datagrid. But when I set the dataset...
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 to change it to visible=true. You can't do that with a bound column (no ID), but you can create a templatecolumn with a label. To make these...
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: MyDS.MasterTable.IDColumn.ColumnMapping = MappingType.Hidden Strangely, when the datagrid appears for the first time, the id column is visible, then, when I...
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 Identifier column so that I can run updates on the SqlAdapter object. Is there a way to hide this column from the datagrid? Dim dv1 As New...
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 want to do is hiding and unhiding the column at the run time without the post back to the server. have anyone come across with such a kind of...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.