|
Hello (Hallo) Tim,
Tim Paaschen wrote: I never said that it is a good idea
I know, and my answere was more meant as a joke than a critic on your statement.
Tim Paaschen wrote: just that it is technically possible
Technically possible, would be a set of keys which he defines during design time.
"All possible Keys" is not technically possible!
All the best (Noch einen schönen Tag)
Martin
|
|
|
|
|
Hi friends..
I have designed one simple windows application in which i am retrvng data from data base and populating it to the grid..I build the solutn and have an .exe file for the same..
Now I am designing a web page with a button on it..I want that windows application to run on click of that button ..though I used java script and used windows.open(".exe path name")..i m still facing the problem..can anyone plz help me..
regards,
Rahul
|
|
|
|
|
|
Hi Tarakeshwar..Thanks a lot..url given by u solved my problem instantly..
|
|
|
|
|
i am using an xml file which has an optional atributes.
Now i want to know that there is no attribute for the node dynamically
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
How are you examining the XML ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
my xml file is
<?xml version="1.0"?>
<lasers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="laserProp.xsd">
<laser LaserName="Laser1" ModelName="Nufern v1.0" SerialNo="1" ManufacturerName="Nufern v1.0" Maximumpower="200">
<properties>
<image>CW-Waveform.jpg</image>
<WaveTypes>
<WaveType Name="CW Waveform" url="CWwaveform.html" isavailable="true"/>
<WaveType Name="Relaxation Oscillation Envelope" url="RelaxOscillation.html" isavailable="true"/>
</WaveTypes>
<tabular>
<property id="40" name="IP" prgbar="false" selected="false" pwd="true" units="C" gauge="false"/>
<property id="200" name="Output Power" prgbar="true" selected="true" min="0" max="200" pwd="false" units="W" gauge="true" amberthresholdval="201" amberwarning="Output Power is near upper limit."/>
</tabular>
</properties>
</laser>
</lasers>
I am reading xml like this
xmldoc2.LoadXml(objXmlTasks.decrypt());
XmlNodeList xmlchildnodelst = xmldoc2.SelectNodes("/lasers/laser[@LaserName='" + laseridval + "']/properties/tabular/property[@name='" + childLaserSelectedName + "']");
for first child node in tabular node there is no attribute("amberthresholdval") so below statement is giving exception
xmlchildnodelst.Item(0).Attributes.GetNamedItem("amberthresholdval").Value
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
You could extract the node and test the attribute to see if it is null. if it is null the attribute is not present.
|
|
|
|
|
when run my program,in ExecuteNonQuery,give me Error : No mapping exists from object type System.Windows.Forms.TextBox to a known managed provider native type. plz help me ((
saeed shafaee
|
|
|
|
|
You are trying to feed a windows control to the database, and it doen't know what to do with it.
I suppose that what you really want to do is to get the value of the Text property from the control and feed to the database instead.
---
single minded; short sighted; long gone;
|
|
|
|
|
|
Hi all,
I'm working on an application, and being new to 2.0 I need some help.
I have a Custom Collection which inherits CollectionBase and i'm using this as a DataGridView datasource. All is fine, apart from the Sorting does not work anymore (I used to manually add each row.) When I tried to use Sort, it complained that my CollectionBase does not inherit the IBindingList class.
I've tried but I never really got far.
Does anyone have any examples which will help me?
<br />
using System;<br />
using System.Collections;<br />
using System.Windows.Forms;<br />
using System.Text;<br />
using System.ComponentModel;<br />
<br />
namespace HelpDesk<br />
{<br />
class RequestCollection : CollectionBase<br />
{<br />
public void Add(Request r)<br />
{<br />
r.Parent = this;<br />
List.Add(r);<br />
}<br />
public Request this[int index]<br />
{<br />
get { return (Request)List[index]; }<br />
set { List[index] = value; }<br />
}<br />
private ImageList _Images;<br />
public ImageList Images<br />
{<br />
get { return _Images; }<br />
set { _Images = value; }<br />
}<br />
<br />
public int OpenCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request r in List)<br />
{<br />
if (r.Status == RequestStatus.Open)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
public int PendingCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request r in List)<br />
{<br />
if (r.Status == RequestStatus.Pending)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
public int ImmediateCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request r in List)<br />
{<br />
if (r.Priority == RequestPriority.Immediate)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
public int HighCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request r in List)<br />
{<br />
if (r.Priority == RequestPriority.High)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
}<br />
}<br />
Thanks
|
|
|
|
|
You may want to use a generic list instead. This article[^] shows you how to add a generic sort routine.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
I use List<...> for a lot of code. I find it convenient to be able to have a wrapped list. Here's an example with a simple method to demonstrate how easy it is:
using System.Collections.Generic;
using System;
namespace Generics.Test
{
public class TestGeneric
{
public TestGeneric()
{
MyList<MyTest> test = new MyList<MyTest>();
test.Add(new MyTest("Test 1"));
test.Add(new MyTest("Test 2"));
if (test.HasValue("Test 2"))
Console.WriteLine("Test 2 is present");
}
}
public interface ISomeValue
{
string SomeValue { get; set; }
}
public class MyList<T> : List<T>, IEnumerable<T> where T : ISomeValue
{
public bool HasValue(string key)
{
foreach (T item in this)
{
if (item != null && item.SomeValue == key)
return true;
}
return false;
}
#region IEnumerable<T> Members
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
for (int i = 0; i < this.Count; i++)
{
yield return this[i];
}
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
}
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi there,
Thanks for the sample code. I've gone to use it this morning and hit another problem.
I've created this:
<br />
public interface RequestCollectionInterface<br />
{<br />
ImageList Images { get; set; }<br />
int OpenCount { get; }<br />
int PendingCount { get; }<br />
int ImmediateCount { get; }<br />
int HighCount { get; }<br />
}<br />
public class RequestCollection<T> : List<T>, IEnumerable<T> where T : RequestCollectionInterface<br />
{<br />
IEnumerator<T> IEnumerable<T>.GetEnumerator()<br />
{<br />
for (int i = 0; i < this.Count; i++)<br />
{<br />
yield return this[i];<br />
}<br />
}<br />
IEnumerator IEnumerable.GetEnumerator()<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
public int OpenCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request item in this)<br />
{<br />
if (item.Status == RequestStatus.Open)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
public int PendingCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request item in this)<br />
{<br />
if (item.Status == RequestStatus.Pending)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
public int ImmediateCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request item in this)<br />
{<br />
if (item.Priority = RequestPriority.Immediate)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
public int HighCount<br />
{<br />
get<br />
{<br />
int ReturnValue = 0;<br />
foreach (Request item in this)<br />
{<br />
if (item.Priority = RequestPriority.High)<br />
ReturnValue++;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
}<br />
And tried using it like this:
<br />
<br />
private RequestCollection<Request> __GetRequests()<br />
{<br />
RequestCollection<Request> rc = new RequestCollection<Request>();<br />
Request r = new Request();<br />
r.Id = 1;<br />
r.Summary = "This is a test";<br />
r.To = "Test";<br />
r.From = new User();<br />
r.Priority = RequestPriority.Normal;<br />
r.Status = RequestStatus.Open;<br />
r.Created = DateTime.Now;<br />
r.Assigned = r.Created;<br />
r.Parent = rc;<br />
r.Hours = r.Created.Subtract(r.Assigned).Hours;<br />
<br />
rc.Add(r);<br />
return rc;<br />
}<br />
but I get the following error:
<br />
Error 3 The type 'HelpDesk.Request' must be convertible to 'HelpDesk.RequestCollectionInterface' in order to use it as parameter 'T' in the generic type or method 'HelpDesk.RequestCollection<T>' C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\HelpDesk\HelpDesk\DataAccess.cs 66 44 HelpDesk<br />
this is my Request code:
<br />
class Request<br />
{<br />
private int _Id;<br />
private string _Summary;<br />
private User _From;<br />
private string _To;<br />
private RequestPriority _Priority;<br />
private RequestStatus _Status;<br />
private DateTime _Created;<br />
private DateTime _Assigned;<br />
private DateTime _LastChanged;<br />
private double _Hours;<br />
private RequestCollection<Request> _Parent;<br />
<br />
public int Id<br />
{<br />
get { return _Id; }<br />
set { _Id = value; }<br />
}<br />
public string Summary<br />
{<br />
get { return _Summary; }<br />
set { _Summary = value; }<br />
}<br />
public User From<br />
{<br />
get { return _From; }<br />
set { _From = value; }<br />
}<br />
public string To<br />
{<br />
get { return _To; }<br />
set { _To = value; }<br />
}<br />
public RequestPriority Priority<br />
{<br />
get { return _Priority; }<br />
set { _Priority = value; }<br />
}<br />
public RequestStatus Status<br />
{<br />
get { return _Status; }<br />
set { _Status = value; }<br />
}<br />
public DateTime Created<br />
{<br />
get { return _Created; }<br />
set { _Created = value; }<br />
}<br />
public DateTime Assigned<br />
{<br />
get { return _Assigned; }<br />
set { _Assigned = value; }<br />
}<br />
public DateTime LastChanged<br />
{<br />
get { return _LastChanged; }<br />
set { _LastChanged = value; }<br />
}<br />
public double Hours<br />
{<br />
get { return _Hours; }<br />
set { _Hours = value; }<br />
}<br />
public RequestCollection<Request> Parent<br />
{<br />
get { return _Parent; }<br />
set { _Parent = value; }<br />
}<br />
public Image PriorityImage<br />
{<br />
get<br />
{<br />
Image ReturnValue = null;<br />
try<br />
{<br />
if (this.Parent != null && this.Parent.Images != null)<br />
ReturnValue = this.Parent.Images.Images[(int)this.Priority];<br />
}<br />
catch (Exception ex)<br />
{<br />
int i = 99;<br />
}<br />
return ReturnValue;<br />
}<br />
}<br />
}<br />
|
|
|
|
|
You've become slightly mixed up in what you need the interface to be. When a generic states where T : ... you are indicating that the type T will implement the interface. Also, you have used a generic list and then hardcoded the type in the iterator. To be honest, you possibly don't need to expose your class as generic because you have a specific non-generic need here. What you could do is declare a List<...> member as a private member and then use your own methods to add to it. If you definitely want to go the generic route here, this is a sample that I have just knocked up.
using System;
using System.Collections.Generic;
using System.Text;
namespace TestIterator
{
class Program
{
static void Main(string[] args)
{
RequestItemCollection<Request> coll = new RequestItemCollection<Request>();
Request req = new Request();
req.Status = RequestStatus.Open;
coll.Add(req);
req = new Request();
req.Status = RequestStatus.Open;
coll.Add(req);
System.Console.WriteLine("Open count = {0}", coll.OpenCount);
Console.ReadLine();
}
}
public class RequestItemCollection<T> : List<T>, IEnumerable<T> where T: IStatus
{
#region IEnumerable<T> Members
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
for (int i = 0; i < this.Count; i++)
yield return this[i];
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
public int OpenCount
{
get
{
return StatusCount(RequestStatus.Open);
}
}
public int Closed
{
get
{
return StatusCount(RequestStatus.Closed);
}
}
private int StatusCount(RequestStatus status)
{
int count = 0;
foreach (T item in this)
{
if (item.Status == status)
count++;
}
return count;
}
}
public enum RequestStatus
{
Open,
Closed,
Pending
}
public interface IStatus
{
RequestStatus Status { get; set; }
}
public class Request : IStatus
{
private RequestStatus _status;
#region IStatus Members
public RequestStatus Status
{
get
{
return _status;
}
set
{
_status = value;
}
}
#endregion
}
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello,
I think you have to call the Sort method of the InnerList property.
There you have to pass an instance of a UserComparer class inheritet from IComparer.
For excample, if your Request class has a Name property which you whant to use for sorting:
public class YourComparer : IComparer
{
int IComparer.Compare( object x, object y )
{
Request request_x= x as Request ;
Request request_y= y as Request ;
if((request_x!=null)&&(request_y!=null))
{
return( (new CaseInsensitiveComparer()).Compare( request_x.Name, request_y.Name ) );
}
else
{
return 0;
}
}
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
I am working with a mobile device. I have a 3GPP video file with the extension .3gp. I want to read the first frame of the video file which contains the format, header realted infos. I want to dispaly the same with as jpeg or gif extension. Can anyone help me regarding this. If anyone is having any source code for that or if anyone can suggest any open sources for this then it will be great.
Thanks & Regards
Ramanath Panda
Ramanath Panda
Bangalore
|
|
|
|
|
Hi,
I have a print preview control that works fine. I've added a tool strip button to allow the user to change the printer settings, this button loads up the PrintDialog.
What i want to do is if the user changes the page layout to be landscape, once they click apply it should redraw the preview. The problem is, how do i fire the PrintPage event to redraw the preview?
Regards,
Gareth.
|
|
|
|
|
I found out on the MS forums that i needed to use: PrintPreviewControl.InvalidatePreview();
Regards,
Gareth.
|
|
|
|
|
Hi
I am doing an application in which I am using a XML file to populate a datagrid.
In that XML file I have one like.....
1.To generate leads efficiently and profitably.
2.To ensure that all details are collected in one call.
3.To provide email and chat support.
4.To manage Work Basket reports as required.
5.To meet targets for both quantity and quality.
When I am trying to populate this column onto datagrid, all these lines or sentences are getting combine and displaying like a paragraph.
I want to know how to format this column to get them in the a new line
Thank u
Chandu
|
|
|
|
|
You could try to add the newline escape (\r\n) chars where you need a new line. I do not know if this will work though.
|
|
|
|
|
Hello,
I have big problem.Please help me.
I playing video with QuartzTypeLib.Video frame are drawing in panel component
and I need drawing my picture(rectangle) on an video.But I dont know which event is calling redrawing frame.
I use protected override onPaint but this metod is call only first time and my picture is redrawing with video frame
How can I do?
I'M beginner in C#
|
|
|
|
|
It's a *lot* more complicated than that. Video is played for you by DirectX, or perhaps another library, and you need to hook into that, the paint event has nothing to do with it.
There's info on the web, it can be done. I am not familiar with QuartzTypeLib, why are you not using the Windows Media player ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|