|
Doh! I had my collection inside my Task class setup as an XMLAttribute. I removed the syntax and it worked.
|
|
|
|
|
I have a situation where I have a Crystal Report pulling data from a database and I want to be able to check a couple of things in the report to determine that it should be printed. Is there a way to pull data out of some fields in the report for verification before printing, or do I have to do a seperate database query in C# to validate such info?
If anybody could help me, it'd be appreciated. I've checked MSDN, BusinessObjects, and all the programming sites I can think of to no avail.
--In a world without fences, who needs Gates?
|
|
|
|
|
SignMan359,
An alternative would be to get a DataSet yourself using a DataAdapter derivative (like a SqlDataAdapter ) and use that to populate the report by calling ReportDocument.SetDataSource . When designing your report, you can bind against an strongly typed ADO.NET DataSet . Read Reporting off ADO.NET Datasets[^] for details.
This would allow you, then, to get the DataSet , check any rows in tables you want, then decide whether or not to instantiate your ReportDocument -derivative that you've designed, set the data source, and display it. This way you can also control whether the report and report viewer are even instantiated in the first place.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
hi
i'm new
when is it best to use setProperty(val) to set a property and when is it best to use property = val?
thanks
|
|
|
|
|
AFAIK it's pretty much the same (IIRC property's getter and setter are actually ordinary functions, whole property concept is just "syntax sugar" - am I right? ). I think it's matter of style.. would you use person.Age or person.getAge() ? I'd use the first one...
p.s if somebody knows guidelines or something about when to use property and when functions, lemme know!
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
I think its a matter of your personal taste.
I always use properties when its just about setting values. The only situation where I make an explicit setter method is when the setter should have another visiblity than the getter. But this will be obsolete with the next framework version.
|
|
|
|
|
thepersonof wrote:
when is it best to use setProperty(val) to set a property and when is it best to use property = val?
If you don't have any specific logic that needs to be applied to simply set the value of the private variable it is best to use a property. If you need to perform some specific conditional logic, etc. when setting the value typically would use a method.
|
|
|
|
|
Nick Parker wrote:
If you don't have any specific logic that needs to be applied to simply set the value of the private variable it is best to use a property. If you need to perform some specific conditional logic, etc. when setting the value typically would use a method.
This is what ive always stuck to as well, glad im not alone in my thinking on this.
|
|
|
|
|
Hello all
how can i convert an int32 to hexadecimal and string to hexadecimal?
i am working at C#
Thanks alot
|
|
|
|
|
Not too sure what your question means but to display an int in Hex, you can use the ToString() method as below. As for converting a string to Hex, I don't quite understand what you mean.
int convertMe = 102;
string converted = convertMe.ToString("X");
|
|
|
|
|
If you need to convert a string with hexdecimal presentation to int look at the Convert.ToInt32 method.
|
|
|
|
|
|
Hi
maybe i am not making any sense..i am creating a HTML file on runtime and opening it in a Webbrowser control,the html also have links..instead of assigning html or other http file link in SRC tag,i want to call my c# function which grab the particular text from webbrowser control and pass it in some C# function,for instance,my HTML have links
1)Apple 2)Oranges,when i click Apple,then it calls MessageBox with text "Apple" etc..is it possible?how can I inject some code to call c# based routines
Thanks
|
|
|
|
|
I can think of two possible solutions to your problem.
The first is to hook-up an event handler for the browser control's BeforeNavigate2 event. You can then use this to parse special commands passed in the SRC attribute and execute particular methods. An example is shown below.
HTML:
Calls Host Form's MyCommand Method
C#:
private void WebBrowser_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
{
// Determine if this is a proper url or a command
if (((string)e.uRL).IndexOf("command:") != -1)
{
// Call the appropriate function for the command
switch (((string)e.uRL).Replace("command:", ""))
{
case "mycommand":
this.MyCommand();
break;
}
// Stop the browser from performing the navigation
e.cancel = true;
}
}
The other method is to hook up some event sinks to capture the DHTML events.
Hope this helps.
Aaron
|
|
|
|
|
|
I hope my already 2 day search ends here !
This is what I want to be able to do: existing app A generates sql-qeurys and sends these as strings to app B (application to develop). These querys are send to a database server and the result is put into two different files (one file with result data layout and the other with actual result data).
Now app B must return a struct with information about these files(location etc) and some additional information to app A. App A reads the files and presents the information to the user.
My question now is: how do I send data (using structs with strings, integers etc) between two applications?
My intention is to use Window Messages for this task using SendMessage / WM_COPYDATA. I have not been able to find an example which made it (crystal)clear for me, maybe someone can help me tackle this problem.
Or do you think this approach is not the good one, please tell me!
Thanks in advance,
Darth
I can't get no satisfaction.
|
|
|
|
|
You could just serialize the sturcture and send it as a byte array from app B over a socket to app A and de-serialize it. This way App A and B do not neccessarily need to be on the same computer. Just an idea.
|
|
|
|
|
Sorry, just saw you were using WinCE, disregard my suggestion.....
|
|
|
|
|
Greetings,
I read somewhere that it is better to do a for loop rather than a foreach loop, as they said that it takes extra processing.
Aren't these doing exactly the same thing? It seems to me that the for loop would take more processing.
<code>
For(int i=0;i<myArrayList.Count;i++)
{
((MyClass)myArrayList[i]).myMember = 3;
}
Foreach(MyClass myClass in myArrayList)
{
myClass.myMember = 3;
}
</code>
Any insight would be greatly appreciated.
EB
|
|
|
|
|
foreach makes a call to the IEnumerable interface and gets an IEnumerator
the enumerator is then responsible for itteration through your list.
the little overhead that is involved in the foreach is the actual calls to the enumerator ".Current" and ".MoveNext"
In my oppinion you should use foreach since id take readable code over a very very minor performance increase any day..
unless i really really need the extra cpu cycles that is..
//Roger
|
|
|
|
|
I started using the foreach loops instead of the for loops and found that they are only to be used for read-only operations. (unless I'm missing somthing?) Looks like only the for loop will work if you want to write to the object. I've never used it before but the foreach seems to be working very fast and is nice for the read-only stuff...
Thanks for your reply Roger.
EB
|
|
|
|
|
|
Foreach is definitely slower than For, especially when iterating over typed arrays.
|
|
|
|
|
Robert Rohde wrote:
Foreach is definitely slower than For, especially when iterating over typed arrays.
That will change with generics in .NET 2.0.
|
|
|
|
|
Excellent, I am trying to squeeze every drop of resources that I can without the code being too cumbersome. Thanks for the confirmation on this... looks like I'm just going to stick with the plain-vanilla for-loops on this one.
EB
|
|
|
|