|
|
Hi:
I have a datagrid in my windows application, which is being populated through a dataset.
The records in that grid are grouped according to GroupNumber field. As an example, let’s say there are 3 records with GroupNumber=99, 5 records with GroupNumber=24, 3 records with GroupNumber=67, and 1 record with GroupNumber=87. The total number of records in my grid is 12 records.
I would like to have blue back ground color for records whose GroupNumber=99; and gray/white back ground colors for the rest of records such that no adjacent groups have the same color (i.e. considering 2 adjacent groups, the back ground color for one group should be gray and the other white).
Any clues, ideas, or suggestions would greatly be appreciated since I am stuck and have no idea how to implement that constraint on my datagrid. Thank you very much in advance!
|
|
|
|
|
The DataGrid is a very light-weight control that isn't nearly as extensible as its future replacement, the GridView (to be released with .NET Framework 2.0). In order to do this, you'll need to use deriviative DataGridColumnStyle s for each column and color them accordingly.
See Changing the background color of cells in a DataGrid[^] here on Codeproject for an example.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have the following problem:
I have 2 classes: MyClass1 and MyClass2. MyClass1 contains a collection ArrayList of MyClass2 objects. In MyClass1 I implement the ISerializable interface. How do I write the constructor for deserialization, especially when I deserialize MyClass2 object?
//Deserialization constructor
public MyClass1 (SerializationInfo info, StreamingContext context) <br />
{<br />
simpleVar1 = (int)info.GetValue("simpleVar1", typeof(int));<br />
simpleVar2 = (String)info.GetValue("simpleVar2", typeof(string)); //and so on with the simple members of MyClass1
//Deserialize MyClass2 objects from the ArrayList (member of MyClass1)
????????????????????????????????????<br />
}
Thanks for the help!
Best regards,
Cristina
|
|
|
|
|
You don't deserialize your MyClass2 objects from the ArrayList , you deserialize the ArrayList . The ArrayList will be deserialized which deserializes each instance of MyClass1 . It's an object graph and unless you plan on serializing an entire object graph from a single class (not a good idea), this is how it works.
Likewise, when you serialize your object, you serialize the ArrayList . The runtime serialization framework will then serialize its elements, then serialize those elements' members, and so on.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Check this code out:
string path = MapPath("faq.xml");
DataSet ds = new DataSet();
ds.ReadXml(path);
XMLGrid.DataSource = ds;
XMLGrid.DataBind(); faq.xml looks like:
<faq>
<sub>
<q>stuff here</q>
<i>stuff here</i>
<a>stuff here</a>
</sub>
<sub>
<q>stuff here too</q>
<i>stuff here too</i>
<i>note this is I</i>
<a>stuff here too</a>
</sub>
</faq> Note that there are two <i> tags in the second sub and only 1 in the first. The code for reading this xml file is a autogenerate columns datagrid and what I get is: Submission_ID and numbers in the column for i instead of two i columns.... I'm guessing there is a way to use the Submission_ID to get at that data, but I'm not sure how to do it programatically. I haven't been successful in googling yet... Any ideas? The following code prints the same Submission_id thing as the datagrid does:
foreach (DataRow dr in ds.Tables[0].Rows)
{
for ( int i = 0; i < dr.ItemArray.Length; i++ )
{
PrintString(dr[i] + "<br>");
}
PrintString ("<br>");
}
side note: How do you use a < in <code> tags without having to type in the html code for it each time?
|
|
|
|
|
XML for a DataSet must follow certain guidelines, and you should have different "columns" for two "tables" unless you have a DataSet schema, which can be generated at design-time using a typed DataSet (using either VS.NET or the xsd.exe utility) or at runtime using DataSet.ReadXmlSchema .
You must encode your < and > with < and > or use the buttons in the toolbar below. The post engine takes your text as-is.
You can also click "Do not treat <'s as HTML tags" before posting, but then if you actually use any tags (like wrapping your code and XML between <pre></pre> tags - which makes it more readable) they will be encoded and show up as text.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok, are you using something different to make your posts or are you just really quick at clicking those < > and & and code buttons?
|
|
|
|
|
I type it all in. It takes longer for me to use the buttons, but I've also been programming for a very long time and started writing web pages when HTML 1.0 was still a draft...and I don't believe in WYSIWYG editors.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Impressive[^]
[Edit] first link was broken... should work now [/Edit]
|
|
|
|
|
I am developing a web interface to my credit card application. I thought I should use AutoPostBack for the credit card number to the server, but now I'm having second thoughts and want some input other ideas or ways to accomplish this.
The credit card number can be manually entered, ie: 4128 0000 0000 0033, or can be scanned from a keyboard wedge and will be something like:
%b4128000000003333^My Name^0405SomeOther data?
When the card is scanned and the field looses focus, I need to capture information from the mag stripe and populate two other fields, the expiration date and the Card Holder's Name. If the its a swipped card, the focus needs to be set on the dollar amount, if not it needs to be set elsewhere. I believe I can handle where its to be set with a cookie.
I don't like the flashing of the screen when this occurs and I'm not sure of how else to do it. Any ideas or thoughts?
Thanks,
Glenn
|
|
|
|
|
Just use javascript. ASP.NET describes server-side code and already uses a little bit of client-side javascript. If you don't want a round trip to the server, you need to implement this with client-side javascript or use the XMLHTTP component (would only work in "up-scale" browsers, i.e. Internet Explorer).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
When you evaluate any product, the two biggest questions you must answer deal with cost and requirements.
Both have different licensing, so you really need to evaluate that.
Both seem to have similar functionality, but CR has been doing this longer (not necessarily always a good thing - personally I think they're getting more inefficient with each version and their managed APIs suck).
With that in mind, I think your biggest concern should be the cost of licensing the products in relation to how you need to deploy your solution.
For example, I know that you can deploy the runtime files and report definitions with your Windows Forms application if you registered your copy of CR for .NET that came with VS.NET. You would've recieved a code via email that you use when you create a Windows Installer package with the necessary runtime merge modules for CR. Specifically, you put this registration code in the regwiz.msm (or something like that) merge module replacement properties.
I did peek at SQL 2000 RS licensing once, but I honestly don't remember much about it. In any case, that's something only you can evaluate.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
We recently bought CR 10.
It's nice, but has a size problem... The merge module is 40 Mbytes...
Free your mind...
|
|
|
|
|
First off I'm new to this development platform so I don't know some of the most obvious fixes for known problems. Anyway, I've developed an application in C# that creates/accesses text files and utilizes the Microsoft Access database. My application runs fine on XP but fails with file access permission failures on Windows 2000 professional (the only other platform I've had access to to try). The .Net framework 1.1 is loaded on the machine and the application comes up with no problems. Only when I try to access a file I start having problems. Is there someting obvious I'm missing? Something particular to Windows 2000 I need to understand? I can't be the only one who has had this problem....can I?
Any help/insight would be appreciated.
Parrish
|
|
|
|
|
Is your app running on the 2000 machine loaded from a network share on the XP machine? If so, that's where your problem is. Since the netowkr machine isn't a trusted server, your code will not have the same access to the system as if it were launched from the 2000 box.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It's running on a Windows 2000 professional network. No XP involved at all.
Thank you for your quick reply.
Parrish
|
|
|
|
|
Also (regarding what Dave said), the file permissions may be different. If your MDB (Jet Database, aka "Access database") is in a directory where you don't have write permissions, then you must change the permissions on that directory.
If you're accessing the file over the network, then your code must have a FileIOPermission that allows access to that resource. This deals with Code Access Security in .NET - a sandbox of sorts that makes it a secure framework. See the article, Understanding .NET Code Access Security[^], for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you very much. I read up on it.
Parrish
|
|
|
|
|
I am trying to write/create a form that takes up the full screen of my pocket pc. In other words the form must obsecure both task bars (bottom and top) of the screen. I cannot get this to work on startup. If I focus off the form by calling up another app and then re-activate - the form becomes full screen. Subsequent forms called from the original startup form behave in a similar fashion.
Can anyone help?
RMe
|
|
|
|
|
A simple have would be to call Form.Activate when your form is loaded.
The correct way requires that you override the CreateParams property, get the base.CreateParams , and modify the Windows styles (which property you set the style using a bitwise OR depends on which style you set - see the Windows CE SDK), then return your CreateParams structure. This the typical way in Windows Forms on non-CE machines.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the response Heath - but I am missing something. This is what I have done.
1. I create a new, empty Smart Device Project
2. I add a windows form to the project
3. I make sure that the window is maximised in the properties
4. I build and deploy on my Pocket PC
I don't see where I get access to Form.Activate. What has bothered me is that the MS help states that the Form.WindowState property is set to normal by default regardless of its initial setting.
RMe
|
|
|
|
|
Sorry, Activate isn't supported on the .NET CF. You'll probably have to P/Invoke SendMessage and send the WM_ACTIVATE message.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the correspondence Heath - however in the meantime I have figured it out. I created an event handler for Form.Load which as you know occurs before the form is displayed for the first time. In the event handler I change the WindowState of the form to maximised, invalidate the screen and ask for an update. This seems to do it for me nicely. See code
//the Event handler
this.Load += new System.EventHandler(this.welcome_Load);
private void welcome_Load(object sender, System.EventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Invalidate();
this.Update();
}
|
|
|
|