|
I have created a bound windows form to a dataset. This application is a time tracking system. On the main form I want the user to be able to navigate back and forth through the dataset. They would click on a monthly calendar control and then the dataset would be filtered for that record.
I'm able to get the data into the form. However, I'm not figuring out how to filter the data. I would think I would need to use some sort of rowfilter off of a dataview.
The structure of the data is like this: I have an identity column called TaskID, I also have a smalldatetime column called TaskDate. TaskID is the primary key. I want to be able to filter the dataset based on the TaskDate.
Thanks in advance...
|
|
|
|
|
The best way to filter and sort is to use a DataView on top of the datatable, about DataView here you have a link about how it works:
http://www.akadia.com/services/dotnet_filter_sort.html[^]
Good Luck
Braulio
/// -----------------------
Braulio Díez
http://www.bdiez.com
/// -----------------------
|
|
|
|
|
I have a custom C++ dll. How can I call a dll API function using DllImport attribute that has an array of floats as one of the functions' arguments? I know how to do it with arrays of integers and strings, but I can't find how to do it with floats.
Denis
|
|
|
|
|
Try something like this:
[DllImport("mydll.dll")]
public static extern void MyFunction( [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] float[] arr );
This should allow you to pass a floating point array with 16 elements.
I hope this helps.
Deus caritas est
|
|
|
|
|
Thanks a lot, will try it out!
|
|
|
|
|
I've got a numerical value that can have only a small number of legal, non contigious values that's stored in an XML file.
The value's defined in the XSD like this:
<code><xs:element name="Number">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:enumeration value="100"/>
<xs:enumeration value="179"/>
<xs:enumeration value="654"/>
</xs:restriction>
</xs:simpleType>
</xs:element></code>
and an entry in the XML looks like:
<code><Number>179</Number></code>
The class created by the XSD tool is:
<code>public enum Number
{
[System.Xml.Serialization.XmlEnumAttribute("100")]
Item100,
[System.Xml.Serialization.XmlEnumAttribute("179")]
Item179,
[System.Xml.Serialization.XmlEnumAttribute("654")]
Item654,
}</code>
When I use the debugger to view the value of a Number that was loaded from an XML file it looks like "Item100". The problem is that if I want to assign it a new value stored in an integer by doing:
<code>numberValue = (Number)100;</code>
numberValue is assigned "100", this will be correctly written if the XML is serialized, but having two different representations for the same value is causing problems elsewhere in my backend. I can't cast the string "Item100" a Number object, and would like to avoid a two dozen item if/else statement of this form:
<code>if (s == "Item100")
num = Number.Item100;</code>
|
|
|
|
|
If you can make the tool create code where the enum values are stored as their numerical value, you can convert the values to and from integers without problem. E.g.:
public enum Number {<br />
[System.Xml.Serialization.XmlEnumAttribute("100")]<br />
Item100 = 100,<br />
[System.Xml.Serialization.XmlEnumAttribute("179")]<br />
Item179 = 179,<br />
[System.Xml.Serialization.XmlEnumAttribute("654")]<br />
Item654 = 654,<br />
}
Otherwise you can loop through the names in the enum and look for a value:
string[] names = Enum.GetNames(typeof(Number));<br />
for (int i = 0; i < names.Length; i++) {<br />
if (names[i] == s) num = (Number)i;<br />
}
---
b { font-weight: normal; }
|
|
|
|
|
i'm not aware of anyway to force the XSD tool to do that, and don't want to make manual changes on that kind of scale.
Your looping solution's offbase for what I want. Since the xml files values are in the "ItemNNN" format, I want to use that one app wide, not the "NNN" format.
I was able to work around this issue a third way. I'd still like to know how to deal with the original issue of not being able to create the same form of the enum that the xmlserializer does when reading the file, but it's became an academic issue for the moment.
I've been refactoring the code related to these objects agressively, and in the process managed to remove almost all of the cases where I was converting a Number to/from a string/int representation. The only remaining locations were places where I was creating the string intermediate, passing it, and imediately recreating the Number object on the other side of the call. My bypass was just to pass the Number directly.
|
|
|
|
|
Int32 connectionFlags = 0;
Int32 connectionName = 1024;
StringBuilder lpSzConnectionName = new StringBuilder(connectionName);
Int32 dwReserved = 0;
Int32 expectedResult = (Int32)(Cookie_Helper.ConnectedStateFlags.INTERNET_CONNECTION_LAN | Cookie_Helper.ConnectedStateFlags.INTERNET_CONNECTION_PROXY | Cookie_Helper.ConnectedStateFlags.INTERNET_RAS_INSTALLED | Cookie_Helper.ConnectedStateFlags.INTERNET_CONNECTION_CONFIGURED);
Boolean GetStateResult = Cookie_Helper.InternetGetConnectedStateExA
(
ref connectionFlags,
lpSzConnectionName,
connectionName,
dwReserved
);
Log.Trace("Received Connection={0}", lpSzConnectionName);-->Nunit Log Statemet
The above code retriving some junk data instead of Default Connection.Could somebody tell me the reason.
Regards,
Visala
|
|
|
|
|
|
Hi!
( Forgive some mistake in my text, I am Vietnamesse)
In VB when I design some labels, I can set its have a name, but their Index different. When event happen, I base on their Index in order to treat. But in C#, I could not found "Index" in Property of Label. What can I do, when I manage 400 Labels?
Can you help me?
Thank for read!
III
|
|
|
|
|
tosen_z wrote: But in C#, I could not found "Index" in Property of Label. What can I do, when I manage 400 Labels?
Use "Tag" property.
<br />
int index = 1;<br />
label1.Tag = index;<br />
....<br />
int val = -1;<br />
if (label1.Tag != null)<br />
val = (int) label1.Tag;<br />
<br />
<br />
Best regards, Alexey.
-- modified at 6:58 Monday 17th April, 2006
|
|
|
|
|
I don't find any property like tag in my Label
Which version of dotnet that U R Using?
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
You're right. Only Framework 2.0.
In this case, you can identify them by location.
Or by name - concatenate some string to name, and then parse it.
Label[] labels = new Label[100];
for (int i = 0; i
|
|
|
|
|
Oh!Great to Hear tat U r Working on 2.0
I still did n't get an opportunity to work on it
Lucky U are!
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
Thankyou!
But, if I have 400labels, to catch "OnMouseDown", do I must write 400funtions (each of labels has a funtion)? If not, I can group all and set event is "OnMouseDown", but how to know "label_1" but not is "label_2", when I click on one?
Thank for read!
III
|
|
|
|
|
You can get the index of label by this code on mouse down event
<br />
private void SplashForm_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
int index = int.Parse(((Label)sender).Name.Replace("Label_",string.Empty));<br />
}<br />
Your label names must be: Label_1, Label_2, Label_3 ....
But I think 400 labels isn't good decision.
Can you use some custom control instead ?
Best regards, Alexey.
|
|
|
|
|
Thank you verymuch!
I know, 400 labels isn't good decision, That make my Program slowly. But, I could found the other instead!
My project is a game that name "Caro". In that game, have 2 player, one use character "X", the other use "O", put on a "space game"( that is 400 labels, a matrix 20*20).
When I design 400labels, automatic, C# will create separately 400 labels. To overcome, I myseft write code in "InitializeComponent()" funtion is "System.Windows.Forms.Label[] myLabels=new System.Windows.Forms.Label[400]"... then it not visible in "Form1.cs [Design]" but haven't any error, and when I build it, and press "F5", in my window of "Form1", I can see immediate 400labels??????? I don't understand!
Thank for read!
III
|
|
|
|
|
I try to draw one pixel wide dashed lines in gdi+, but the result is very different from the one obtain with the gdi api functions. Te big problems are on diagonal lines or the lines which are not horizontal or vertical. If someone knows how to draw this lines in gdi+ with the same visual efect as in gdi please answer. I try with or without SmoothingMode, with or without PixelOffsetMode but the results are no better.
The best difference is on custm dotted lines with one pixel on - one pixel off
-- modified at 9:28 Thursday 20th April, 2006
|
|
|
|
|
Hello there
I have an image with Jpeg compression. When I try to load that file it gives me error "out of memory". Can any one guide me how to load the file ?
Image img;
img.FromFile("C:\\test\\1.tiff");
For Sample image with Jpeg Compression please download from the link below.
http://www.alm-soft.com/Rizwan/1.tiff[^]
I shall be very thankful to you for your kind support.
regards
Rizwan Bashir
-- modified at 5:15 Monday 17th April, 2006
|
|
|
|
|
Here's how you use the FromFile method:
Image img;<br />
img = Image.FromFile("C:\\test\\1.tiff");
---
b { font-weight: normal; }
|
|
|
|
|
Thanks but if you download the image file and run this code it will not work.
this image has jpeg compression you can load it in office document imaging but cannot in .net.
|
|
|
|
|
There is something wrong with the file. Some programs will open it, but Photoshop refuses to. How have you created the file?
---
b { font-weight: normal; }
|
|
|
|
|
this is a tiff file compressed with jpeg algorithm.
when I scan the image my scanner returns me this format image
-- modified at 7:35 Monday 17th April, 2006
|
|
|
|
|
This happens because GDI+ doesn't fully support JPEG compression in TIFF files. You'll have to either use an uncompressed version of the file or one compressed using LZW.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|