|
this article[^] seems to solve it. Also, have you looked at the .NET 2's System.Windows.Forms.WebBrowser control?
|
|
|
|
|
Excellent.. just what i was looking for.
Thanks a ton!!
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
webBrowser1.IsWebBrowserContextMenuEnabled = false;
|
|
|
|
|
I'm trying to do the equivalent of this in LINQ:
StringBuilder q = new StringBuilder("SELECT * FROM customer WHERE city = 'New York'");
if (westCoast)
q.Append(" OR city = 'Los Angeles'");
Here's what I have so far:
var q = dc.Customer.Where(c => c.City == "New York");
if (westCoast)
q.Where(c => c.City == "Los Angeles");
But I end up with "WHERE city = 'New York' AND city = 'Los Angeles'";
How do I tell it to use OR instead?
Thanks,
Alvaro
God existing isn't entirely impossible, but there's absolutely no evidence for it, so... the personal God as described by the Christian Bible existing is just as likely as a Pink Unicorn having created the universe, oh.. say... last Thursday. It's equally possible the moon has a core made of cheese. It's equally possible this sentence is in Spanish when you're not looking. - Someone on the Internet
|
|
|
|
|
Hi Alvaro. I haven't used LINQ too much, but I understand the Where method takes a Predicate<Customer>. All you're doing is writing a lambda expression, kind of shorthand for an anonymous method. Here's a more verbose version that should work, assuming Where takes a predicate:
var q = dc.Customer.Where(Criteria);
...
bool Criteria(Customer input)
{
return input.City == "New York" || (westCoast && input.City == "Los Angeles");
}
I'm not sure, but you may be able to do this right inside the lambda:
var q = dc.Customer.Where(c => c.City == "New York" || (westCoast && c.City == "Los Angeles"));
|
|
|
|
|
Thanks for your reply Judah.
I was more looking to do this in two steps, as an exercise. The first step sets up the base query, and then it would start growing based on different criteria. As I discovered, the default behavior is to AND the conditions together on multiple calls to Where . I was hoping someone would know how do change that to use OR instead.
Regards,
Alvaro
God existing isn't entirely impossible, but there's absolutely no evidence for it, so... the personal God as described by the Christian Bible existing is just as likely as a Pink Unicorn having created the universe, oh.. say... last Thursday. It's equally possible the moon has a core made of cheese. It's equally possible this sentence is in Spanish when you're not looking. - Someone on the Internet
|
|
|
|
|
I'm afraid I don't know how to do in 2 seperate pieces rather than 1 query with multiple conditions. Have you tried asking in the MSDN forums? I'm thinking too few people here have played with LINQ, so it might be tough getting an answer.
|
|
|
|
|
Hello all,
I have a process that runs periodically and modifies data. At the end of the process, it needs to create an excel document and email it to several recipients. I've tested the excel generation code from a Winforms app and it works flawlessly. However, when I wrapped the same functionality in a Windows service, it just stops cold. No errors are thrown, and the service keeps running. Is it possible that Excel requires an interactive user to be automated (seems lame, but possible)? That's the only thing I can think of.
Will
|
|
|
|
|
There might be some user rights issues. Have you checked the event log? Are you logging the errors/exceptions, if yes, please check what that is. That could lead you to actual cause, why you are not able to work with excel.
- ashish
|
|
|
|
|
hi
i created a report in my solution with crystalreport for print my datagridview's records, and i add a date object to Crystalreport designer that show date in my report. but i want to change this vlaue in my app programmatically, but how to change it from my code ?
thanks .
|
|
|
|
|
Create a parameter field for the date. When you create the report object, use the ParameterFields Collection of the ReportDocument to find your paramter. Set it using the .CurrentValues.Add property of the ParameterField.
ReportDocument report = new ReportDocument();
report.Load(@"MyReportFile.rpt");
foreach(ParameterField field in report.ParameterFields) {
if(field.ParameterFieldName == "MyName") {
field.CurrentValues.Add(MyDateValue);
}
}
|
|
|
|
|
Does anyone know if it is possible to get a footer or a totals line in a Datagridview on a windows form? If anyone has any idea please help!!
|
|
|
|
|
there is no such facility provided by the data grid.you can do two things either make a custom control data grid or insert a new row in the table with desired values
sameer
|
|
|
|
|
I have an app that currently creates several worker threads in the mainform constructor. I'm currently modifying it to only allow one running copy at a time. The issue I have is that since the threads are created in the constructor prior to starting the app, when the already running check is done and the main thread isn't started they're orphaned and the 2nd instance remains hiding in the process list.
I've found two possible workarounds for this. The first is to move the thread creation from the form constructor to the OnLoad event, so that they're never created on the aborted 2nd instance attempt. The second is to explicitly create the form on the Main method and then do an explicit dispose, after the run call.
MyFormClass theForm = new MyFormClass();
SingleApplication.Run(theForm);
theForm.Dispose();
Is there any design reason to prefer one over the other?
http://www.codeproject.com/csharp/singleinstance.asp
|
|
|
|
|
why don't you do your test by using a mutex before Application.Run ?
|
|
|
|
|
The wrapper class I'm using to prevent multiple instances does do that. In order to remain a generic implementation that can just be dropped into additional apps however, it can't have any specific knowlege of what form it's creating. This means that the form has to be passed to the class that does the check and then launches the app, which in turn means that the constructor has to be called before making the check.
|
|
|
|
|
I declare a struct like this :
struct dataSeg
{
char[] QN;
char[] PNUM;
StringBuilder CP;
}
I want to init the member such as QN,PNUM,CP
How can I init the QN.......?
My meaning is:when I declare a variable of dataSeg ,I want QN, the member of the variable,can be alloc 20 bytes?
How can I get the result?
|
|
|
|
|
Use a class and do that:
char[] QN = new char[20];
Struct don't allow field initializers.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I would strongly advice you to make a class instead of a struct, as the data that you store in it are objects.
In the constructor you can create the objects. Example:
public dataSeg() {
this.QN = new char[20];
this.PNUM = new char[42];
this.CP = new StringBuilder();
}
I assume that you wanted the QN to be 20 characters, not 20 bytes, as 20 bytes would be 10 characters.
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
I have a few comboboxes on the form. They all have the same datasource, the only thing I want to implement is if one of the comboboxes has a value selected, it will be filtered out from the other comboboxes, meaning you can't select the same value in two, or more comboboxes, it can only appear in one combobox. Is there a way to do it?
Thank you.
|
|
|
|
|
i didn't find any direct method for it but you can achieve desired behaviour by making copy of datasource and filter datasource when selected value of a combobox get change.
sameer
|
|
|
|
|
Some controls have properties that are ambient, which makes them set as the controls parent/container. Does anyone know how this can be avoided? I have found this to be connected to the Site-property in controls, but cannot see how I am to go about it if it's at all possible.
Any hints?
All needed for evil to prevale is for good men to do nothing.
C
|
|
|
|
|
if you want to display a control so you have to embedded it some where.so parent child relationship get genrated automatically.so you cant avoid it.to access added control you can use container.Controls
sameer
|
|
|
|
|
Hi all,
i have a peculiar problem in closing the windows forms.
In order to work with multiple instances of same form asynchronously,i am invoking the method using the beginInvoke method of a delegate as follows:
testDelegate del = new testDelegate(SubmitData);
del.BeginInvoke(null, new object[] { });
Its working fine . But when i close these instances, application is getting hanged.
In close button i just wrote this.close() method.
This application is a .net 2.0 windows application.
Can any one help me out to solve this please...
Thanks,
Pranu.
|
|
|
|
|
We'd need more code to help you out. SubmitData, what does that function look like? If your app hangs on close, can you pause execution under a debugger and see what it's trying to execute?
Another possibility: each thread, apart from the main UI thread, should have its Thread.IsBackground property set to true. Otherwise, your app will stay alive while those threads are running.
|
|
|
|