|
how to creat a setup project that will install an application through a wizerd ?
how to creat DNS programatically ?
how to logoff and login programatically ?
r00d0034@yahoo.com
|
|
|
|
|
I hope anyway!
I want to do (for example):
StreamReader sr;<br />
if (cond1)<br />
sr = new StreamReader(@"C:\temp.txt");<br />
<br />
for (int i = 0 ; i < 100 ; i++)<br />
{<br />
if (cond1)<br />
sr.WriteLine("{0},{1}",v1,v2);<br />
}<br />
<br />
if (cond1)<br />
sr.Close()
but the compiler flags up (sr) as unassigned. What's the easy way out of this?
Rgdz
B.
|
|
|
|
|
Why are you writing to a StreamReader?
My guess is that you really want a StreamWriter and because the file doesn't exist, new StreamReader(...) , it's returning null .
Paul
|
|
|
|
|
Oops, sorry typo. I wish that was the problem!
The trouble is I only want to use the StreamWriter (!!) if a certain condition is true. Otherwise, don't use it. Since C# uses references, if I don't declare it, the compiler flags it as null regardless of what conditional it's inside
In C++ I could do:
Writer* pWriter;<br />
if (cond1)<br />
pWriter = new Writer;<br />
<br />
if (cond1)<br />
pWriter->WriteLine()<br />
<br />
without any trouble, which is what I'm trying to achieve in C#
Rgdz
B.
|
|
|
|
|
Barry Lapthorn wrote:
Oops, sorry typo. I wish that was the problem!
Well, you said it was simple.
If I'm understanding you correctly, I think this might help.
You can set a StreamWriter to StreamWriter.Null which does all the work for you. You can write to it as much as you like and it all just disappears into Bill Gates ass (or something like that ).
Paul
|
|
|
|
|
Almost but I want it for a generic object as well. I think the next item in the thread answers it.
I'm a C# noob I'm afraid
B.
|
|
|
|
|
Sorry, yeah, I missed the point completely again. My biggest fault is always looking for something bigger than it actually is. I should have read the bit about assignment a bit more carefully
I'd still advise using StreamReader.Null [edit]StreamWriter.Null, duh![/edit] purely because it means you don't have to worry again about whether it's null or not.
Paul
|
|
|
|
|
I wasn't exactly on top form either as the compiler error message does actually say that the variable was unassigned/undefined! Which tells you that you should set it to something. Doh!
Thanks
Barry
|
|
|
|
|
Paul Riley wrote:
My guess is that you really want a StreamWriter and because the file doesn't exist, new StreamReader(...), it's returning null
I didnt even see that!
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
StreamReader sr = null;
That should the compiler behave null is an assignment.
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Ah ha! That solves my problem.
I'm just getting started on C#. I should have realised that straight away though!!
Thanks.
B.
|
|
|
|
|
Using the setup template, that came with VS.NET, I successfully created an installer for my application. Behind the scenes, it creates two seperate user interface sets. One for the admin and one for the normal users. I have a few bugs in the 'normal users' installation.
How do I limit the installation to allow only administrators to install the application?
Im sure someone knows. Thanks in advance.
|
|
|
|
|
I found a solution! Here it is:
First, download the MSI sdk, and Install it. Then install Orca. Orca is used to edit the setup database tables. Open the msi package in orca. Go the the Control Conditionals table and set a conditional disable to the next button on the Welcome page. Also add another string to explain that admin rights are needed (Added to the controls table). Set a conditional show and hide on the text strings.
The result:
When a normal user tries to install the can only click on exit.
When admin tries to install they can click next and go on.
I hope this helps someone. Orca is very cool. Can be complex to use, but very cool nevertheless.

|
|
|
|
|
Is it better than the MSI projects in VS.NET? I have a couple MSI projects and was wondering if there was a benefit to using Orca and the SDK instead of just VS.NET.
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
I've been playing with asynchronous streams and have a question. When I use the beginRead method for asynchronous reading, the for loop in the code below never gets called until the entire file(fairly large) is completely read(ie. mutiple begin reads and callbacks). I thought that the code should process the for loop while doing some reading of the file and when the read completes right it to the screen. This continues until the entire file is read thereby alternating the output from the for loop and the reading of the file. This is not occuring for me. Is there something I'm missing? I've tried this numerous times using different types of streams and the same thing occurs. Code snippet below:
FileStream inputStream; // inputStream is a filestream
public void Run()
{
inputStream.BeginRead(buffer,0,buffer.Length,new AsyncCallback(this.Callback),null);
for(long i = 0; i <500000; i++)
{
if(i%10000 ==0)
Console.WriteLine(i.ToString());
}
}
public void Callback(IAsyncResult ar)
{
int bytesRead = inputStream.EndRead(ar);
// write output to screen
}
|
|
|
|
|
does anyone know where to start?
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
|
thanks, looks just like wat i need.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
|
your damn straight, why should i do any research, wheni have you here to do it for me
Besides, i had more important things to do yesterday.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Nnamdi Onyeyiri wrote:
Besides, i had more important things to do yesterday.
More important things to do than programming!?!?! You've lost your mind!
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
David Stone wrote:
More important things to do than programming!?!?! You've lost your mind!
of course i havent, i was lookin up research on electric toothbrushes, and anthropometric data on the hand.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
I have noticed that programs that use GDI+,
when their windows is moved particially
outside of the screen area, when they are
moved back, they start redrawing everthing
from the beginning (which is very slow).
This doesn't happen with OpenGL or DirectX
programs (lets say: all of them show some
3D objects: a cube, some lines, etc - nothing
more). Why happens this to GDI+ programs?
What should be done to avoid it?
SHould I post a specific link to an example
of this effect?
|
|
|
|
|
Zibar wrote:
Why happens this to GDI+ programs?
Basically this depends on how the application was written. You can specify the clipping region of your screen that gets redrawn with GDI+. I would suggest reading the article : Professional C# - Graphics with GDI+[^]
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
I am not able to get a list of Users from my Domain Controller using a DirectorySearcher. I am catching an execption "A referral was returned from the server". I have added setting the RefferalChasing option to 'all' and I still get the same exception. The Domain, and Server are correct(changed here to protect the guilty).
Does anyone have any ideas?
DirectoryEntry Root = new DirectoryEntry("LDAP://Domain/cn=Users,DC=Server");
DirectorySearcher Searcher = new DirectorySearcher(Root);
Searcher.ReferralChasing = ReferralChasingOption.All;
try
{
SearchResultCollection Results = Searcher.FindAll();
foreach(SearchResult Res in Results)
{
Console.WriteLine(Result.Properties["cn"][0]);
}
}
catch(Exception Ex)
{
Console.WriteLine(Ex.Message);
}
John Marshall
JMarshall@aafcu.com
|
|
|
|