|
Forgot to note that these codes are in a web app. Win app works OK.
|
|
|
|
|
Does the asp_wp user on the web box have permissions to view/write to that file share?
The actual logged on user's credentials probably aren't even being used because it's running through IIS.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|
|
In fact I changed the authentication methods for that web site on IIS. I don't use the default IUSER_WORKSTATIONNAME user. Instead I entered a domain user name and password. And I set that shared fold to allow every one can read/write. But still I got "wrong user name or bad password error message".
It really confused me.
RT
|
|
|
|
|
1. Say I have Project A, which references Project B and Project B then references Project C. Why must I add a reference to Projects B AND C in Project A?
2. What can I do to resolve a circular dependency? I have an application that references a class library (separate dll), but that class library requries access to a class in the main application. Hey presto circular dependency
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hope this answers your questions...
Even though all of your projects are in the same solution, anything that is outside of a project is still external. Each project would compile down to independant assemblies. So you must create reference by project to make Project A aware of where, exactly, should it go to resolve dependancies. The solution then manages the dependancies and compile hierarchy.
Circular references used to be a problem with prior languages because once you release the object it still hangs around. (memory management would see the existing reference between the two objects and not destroy them) This would be really bad in a case where the object is created many times. So if you create an object and it creates an object and they have circular reference, then when you released the first object it never went away.
Garbage collection now handles circular references better. If you create object B which creates object C which references object B.....when your program ends its' use of object B, it is detected by GC. So it will destroy both object B and C at garbage collection time since the these two objects reference each other but have no parent owner.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
theRealCondor wrote:
Even though all of your projects are in the same solution
My project dependency question relates to situations where the projects are not even in the same solution. Say for example Projects A, B, and C all have there own solution; from the example I gave, Project A would need to add a reference to both Projects B and C, even though it doesn't use any of the classes provided by Project C.
theRealCondor wrote:
Garbage collection now handles circular references better.
Apologies if I wasn't clear in my original post, but my circular dependency problem is one relating also to projects: Project A (producing A.exe) requires a class in Project B (producing B.dll), but Project B requires a class in Project A. Neither project will build until a reference can be added to the other In C++ I can do this with a forward reference, but C# doesn't seem to support this.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
|
I'm having the same problem with circular references describes above. Two DLLs that reference each other so neither one can compile without the other already being compiled. Could you elaborate on your solution a bit?
|
|
|
|
|
I´ve an instance of a class that is shared among more than one thread. I need this thread to wait (I mean wait, not sleep inside an infinite loop) until a specific property of this object changes (something like a waitforsingleobject). Does anyone know how can I do this in c# ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
"Th@ langwagje is screwed! It has if's but no end if's!! Stupid php cant even do butuns on forms! VISHAUL BASICS ARE THE FUTSHURE!" - Simon Walton
|
|
|
|
|
hi Mauricio,
check out Thread.Join method.
Cheers
Kannan
|
|
|
|
|
Kannan Kalyanaraman wrote:
check out Thread.Join method.
Not extacly what I want... this method will just wait till the thread ends. What I´m trying to accomplish is this:
MyObject = new MyClass();
MyObject.SomeProperty = "XYZ";
while(<here I need something to suspend this thread until
the "SomeProperty" of the class instance changes">);
{
// Do some processing here
}
Any ideas ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
"Th@ langwagje is screwed! It has if's but no end if's!! Stupid php cant even do butuns on forms! VISHAUL BASICS ARE THE FUTSHURE!" - Simon Walton
|
|
|
|
|
You could just use .Net's equivalent for WaitForSingleObject(), something like:
MyClass MyObject = new MyClass();<br />
<br />
MyObject.SomeProperty = "XYZ";<br />
<br />
Thread thrSomeThread = new Thread(new ThreadStart(ThreadRunner));<br />
thrSomeThread.Start();<br />
<br />
lock(MyObject)<br />
{<br />
Monitor.Wait(MyObject);
}<br />
<br />
public void ThreadRunner()<br />
{<br />
}
public int SomeProperty<br />
{<br />
set<br />
{<br />
m_iProperty = SomeProperty;<br />
<br />
lock(MyObject)<br />
{<br />
Monitor.Pulse(MyObject);
}<br />
}<br />
}
A bit simplified, but that's the jist of it.
Cheers
|
|
|
|
|
that should work... but...
I don´t have any control over the thread that modifys the property.
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
"Th@ langwagje is screwed! It has if's but no end if's!! Stupid php cant even do butuns on forms! VISHAUL BASICS ARE THE FUTSHURE!" - Simon Walton
|
|
|
|
|
In xp prof window when we click start->Run then run window(with title Run) appears
is there any way in a program that this window appears programatically ?
if it is an exe file where is it?
so that i could start it like a process.
r00d0034@yahoo.com
|
|
|
|
|
To make the window appear programmatically, you need to add reference to shell32 dll in the system32 directory to your c# project.
Once this is done, you create an instance of shellclass and call
the FileRun method.
The code looks like this
<br />
ShellClass obj = new ShellClass();<br />
obj.FileRun();<br />
Hope this helps.
Cheers
Kannan
|
|
|
|
|
You could write a dialog box that does the same thing, basically prompting the user for the name of the exe/program, and then passing the information to ShellExecute or CreateProcess (WIN32 API). If you are using C#, then you could use Process class.
Gaulles
http://www.gaulles.com
|
|
|
|
|
Hello ,
I am trying to pring crystal report without openning a window with the crystal report itself.
I succeeded to print crystal report without parameters by doing:
ReportDocument report = new ReportDocument();
report.Load@"G:\Reports\Rp3Reciept.rpt");
report.PrintOptions.PrinterName = @"\\HPLaserJ5";
report.PrintOptions.PrinterDuplex = PrinterDuplex.Default;
report.PrintToPrinter(1,false,1,1);
and it is working good , but how can I send parameters to reportDocument.
or How can I print report from CrystalReportViewer(becuase to it I can send parameters).
(the printReport() method is virtual , that meens I have to write it?!)
Thank you very much for any answer.
sharon
|
|
|
|
|
You will need to use an object called ParameterFieldDefinitions. It's a collection of the parameters on your report. Here is a simple little function that you may be able to use. It takes a string for the parameter name and in integer for the parameter value. Of course, you could overload this function for other parameter types, but it demonstrates how to set a parameter value on a report. Crystal could certainly make this process easier than they do.
public void SetParameterValue(string szParamName, int iValue)
{
ParameterFieldDefinitions paramFlds = report.DataDefinition.ParameterFields;
ParameterFieldDefinition paramFld = paramFlds[szParamName];
ParameterDiscreteValue discreteValue = new ParameterDiscreteValue();
ParameterValues paramValues = paramFld.CurrentValues;
paramValues.Clear();
discreteValue.Value = iValue;
paramValues.Add(discreteValue);
paramFld.ApplyCurrentValues(paramValues);
}
Ron Ward
|
|
|
|
|
Thank you for this , but I still don't know how can I
print this report with its parameters.
ok, let say i made collection of parameters, how can i connect it to the report in order to print the report without preview?
maybe with ReportDocument or some other object?
Thank u anyway, sharon
|
|
|
|
|
In your original message you indicated that you were able to print to the printer; with a report that had no parameters. Your code is correct there; you assign the PrinterName property and then call the PrintToPrinter method. If there are parameters you need to pass and/or database connection information you need to set for your report to print, you simply must set those properties before you call the PrintToPrinter method. All of these methods and properties are within the ReportDocument object. So the code would be something like the following:
public class Form1 : System.Windows.Forms.Form
{
ReportDocument m_PrintJob;
public Form1()
{
try
{
m_PrintJob = new ReportDocument();
m_PrintJob.Load("C:/MyReport.rpt");
if (m_PrintJob.IsLoaded)
{
SetConnectionInfo("MyDBServer", "MyDBName", "MyUserName", "MyPassword");
SetParameterValue("ParameterName", 100);
m_PrintJob.PrintToPrinter(1, false, 0, 0);
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
public void SetConnectionInfo(string szServer, string szDatabase, string szUser, string szPassword)
{
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
Tables CrTables = m_PrintJob.Database.Tables;
for (int iIndex = 0; iIndex < CrTables.Count; iIndex++)
{
crtableLogoninfo.ConnectionInfo.ServerName = szServer;
crtableLogoninfo.ConnectionInfo.DatabaseName = szDatabase;
crtableLogoninfo.ConnectionInfo.UserID = szUser;
crtableLogoninfo.ConnectionInfo.Password = szPassword;
Table CrTable = CrTables[iIndex];
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
}
public void SetParameterValue(string szParamName, int iValue)
{
ParameterFieldDefinitions paramFlds = m_PrintJob.DataDefinition.ParameterFields;
ParameterFieldDefinition paramFld = paramFlds[szParamName];
ParameterDiscreteValue discreteValue = new ParameterDiscreteValue();
ParameterValues paramValues = paramFld.CurrentValues;
paramValues.Clear();
discreteValue.Value = iValue;
paramValues.Add(discreteValue);
paramFld.ApplyCurrentValues(paramValues);
}
}
Ron Ward
|
|
|
|
|
it seems You must use windows messages, like WM_DEVICECHANGE but I don't know
how do that ....
So can You help me ?
Thanks !
|
|
|
|
|
I have found the solution:
example for devicechange and resolution change:
protected override void WndProc( ref Message m)
{
base.WndProc(ref m);
switch(m.Msg)
{
case (int)Utils.WindowsMessages.WM_DEVICECHANGE:
MessageBox.Show("DEVICECHANGE !");
switch((int)m.WParam)
{
case (int)Utils.WindowsMessages.DBT_DEVICEARRIVAL:
MessageBox.Show("CD INSERTED !");
break;
// Default
default:
break;
}
break;
case (int)Utils.WindowsMessages.WM_DISPLAYCHANGE:
MessageBox.Show("The resolution have been changed !");
break;
// Default
default:
break;
}
}
Bye !
|
|
|
|
|
I have a little problem. I have been hacking together a listview control that will not highlight the icon. I am almost there. I wanted to use SystemColors.HighlightText as the color to highlight the listitem just like everything else does. It appears that SystemColors.HighlightText is returning White or RGB of (255,255,255). Am I just totally missed something or what?
Anybody know what the RGB is of the standard highlight color?
|
|
|
|
|
use : SystemColors.Highlight
thats the bg color (usually dark blue)
//Roger
|
|
|
|
|
This must be so basic a need that everyone knows it, yet I cannot find a reference anywhere.
I want to programmatically from C# bring up the 'default" defined web browser and point it at a particular URL.
Can someone point me to a URL with a reference?
Thanks
-Adrian
|
|
|
|