Thanks Dave, I created a custom Button and got rid of all the issues I had and got it the way I wanted it. Thanks alot to all.
Thanks & Regards,
Thanks Dave, I created a custom Button and got rid of all the issues I had and got it the way I wanted it. Thanks alot to all.
Thanks & Regards,
Hello, I have 2 Buttons in my form. Both have background image and Flat style is "Flat". 1) On clicking TAB key, when the focus is on button, I see solid color rectangle inner, instead of solid border I want to have dotted border in the button. 2) If the button is on focus & the application loses focus (someother app is active), the button forms a outer border of white color. I want it to remain as it is i.e. dotted line inner rectangle. 3) When the button is clicked, some activity is going on. While this time the button text colro changes to grey. I don't want it to change the text color. I believe this is windows std property, but how do I not change the text color when the button is selected :~. I can't find any properties to set these points. What should I do to achieve the goal. Any help is highly appreciated.
Thanks & Regards,
Hi, I have a Combobox, who gets Gradient blue color when mouse-over or clicked. I managed to change the color of selecting Items background, but the mouse over background color couldn't change.
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Border Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Background}" Padding="2">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#F7F7F7" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
On adding the above code, MouseOver is definetely achieved i.e. Background color is changed on MouseOver. But with this, I can't see the drop down triagle icon or click the combobox that shows the drop down. What am I lacking and ho to achieve it ? Any help is highly appreciated.
Thanks & Regards,
Thanks Dave for clean and clear explaination and how should I handle this. Thanks & Regards,
Thanks AspDotNet, Thomas, Dave. >>One which will take a redesign to fix and a major overhaul of your code. Dave, can you explain a bit on what are you trying to say and how and what factors to look for in the code. Thanks & Regards,
Thanks AspDotNetDev, Its a high-end reqd to generate ID programmatically and not auto. Thanks & Regards,
I have an vb.net application that is being used by multi-users. I execute all sql statements in a seperate block all at one time one after another. Many times it so happens that 2 records (referrenced by 2 persons) are stored in a single id which should be stored in different id. What should I do to avoid this type of conflict ? Thanks & Regards,
I agree with Patrick. In the end of if statement replace ";" with "{" Your for loop, initialize localObject of type Object = null, NO END condition and assign localObject = localIntent Their is no meaning for this loop as you are returning on first run, you can remove the for loop and work normally. Yet with your problem, replace return statement after Intent localIntent3... and typecast it : return (Intent)localObject; This will free you from the error and if you code is proper, then will receive proper results. Hope this helps. Thanks & Regards,
Thanks, but I don't want such huge code for a small task. I believe such a thing can be done with no big pain. Couple of days ago I had seen a codeo nsome site that showed stdin & stdout using Process and cmd. I searched a lot but couldn't find that site back. On my start of process, immediately after 1 line, cmd needs to input username. The code I have written doesn't let the user write anything and just goes away. When and how can the app know that it needs to write/input something. If its the 1st time then its username, if 2nd time then password. That's it. Then no input only get the output. But am not able to know when and how to know. Just saw WaitForInputIdle(). Might be that can help me. Will try with that.
Thanks & Regards,
Thanks Dear, But no, can't add like that. Can either pass a txt file or input on screen. As I don't want to have txt file with readable username & password, so thought of this option.
Thanks & Regards,
Hello, I have created a Process that runs a command from cmd and handles it's output using event Handler. I want to input user name when cmd asks for "Enter Username :". This comes immediately after 1st line. Then comes Enter Password where I want to pass password. Then their is no input and can use my event handler till I am done. I tried the following, but didn't work :
processInfo = new ProcessStartInfo("cmd.exe", "/C " + command);
sb = new StringBuilder();
processInfo.UseShellExecute = false;
processInfo.RedirectStandardOutput = true;
processInfo.CreateNoWindow = true;
public int ConnectToServer()
{
processInfo.RedirectStandardInput = true;
process = Process.Start(processInfo);
process.StandardInput.WriteLine("username");
process.StandardInput.Flush();
process.StandardInput.WriteLine("myPswd$");
process.StandardInput.Flush();
process.StandardInput.Close();
process.BeginOutputReadLine();
process.OutputDataReceived += new DataReceivedEventHandler(Process\_OutputDataReceived);
}
private void Process\_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
string d = e.Data;
if (!string.IsNullOrEmpty(d))
{
if (d.indexOf("Completed")) {
connected = true;
}
}
}
It shows error authentication failed. I guess I didn't input username & passowrd on time, so this must have happened. How to know when the app is asking to write and to write proepr details ? I didn't find such way of inputting in any articles searched on internet. Any help is highly appreciated.
Thanks & Regards,
Truly telling I read Threading tutorials of C#, but not getting such ways of threading. I mean calling method in it and such. I get threading of Java & C++ nicely, but C# can't get in mind properly. :~ If StartConnect is in a Thread, it cannot throw exceptions. If adding such type of code in a thread is best practice, then how to accomplish such activity as I have done. If I am wrong in my this thought, please tell me. Without putting in thread (the current situation), its working proper & also showing exception of cannot find file only. Thanks a lot for this. Please if you can help with the above also would be great. Atleast guide, I am not asking for written code. As said, this type of threading doesn't fit proeprly in my mind, so need assistance.
Thanks & Regards,
modified on Thursday, February 3, 2011 9:38 AM
YES, then it should have printed "THROWN". >> Best guess: You are swallowing or ignoring the exception at a higher level. Didn't get you. Can you please explain it or show proper guideline to modify accordingly.
Thanks & Regards,
You see the code of StartConnect. I think and hence wanted to add StartConnect() in a thread and catch exceptions like that, but it didn't work out. Is it better to handle it in thread (the code that's commented) or as I have dneo is correct. If the commented is correct, then how to trap exceptions that are thrown by StartConnect or not to throw exceptions and handle them in that method only. Please guide me for this also. I am on this issue from last 3 days, on many trials couldn't suceed. Your points are helping to suceed. Thanks a lot. I highly appreciate it. Please keep helping on this issue and help me run the code normally to its and yours best.
Thanks & Regards,
Both are of different solutions. But yes, realized during debugging & removed the errorMsg = "" & connected = false lines. And now I see that errorMsg has value in it. Implementaion PART :
try
{
//conThread = new Thread(new ThreadStart(StartConnect));
//conThread.Start();
StartConnect();
}
catch (ThreadAbortException te)
{
Console.WriteLine("Abort Exception CAUGHT");
}
catch (Exception ex)
{
string msg = ex.Message;
if (msg.Equals("NotConnectedException"))
MessageBox.Show("Error connecting to the Server : Connection Time Out \\n Unable to connect to the Server", "Time Out", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else if (msg.IndexOf("Cannot load CA certificate file") > 0)
MessageBox.Show("Error connecting to the Server : Problem with Certificate File \\n Unable to Load or Find required Certificate file.", "Failed to Connect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else if (msg.IndexOf("Error opening 'Auth' auth file:") > 0)
MessageBox.Show("Error connecting to the Server : Problem with Authentication File \\n Unable to Load or Find required Authentication file.", "Failed to Connect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else if (msg.IndexOf("Error opening configuration file:") > 0)
MessageBox.Show("Error connecting to the Server : Problem with Configuration File \\n Unable to find required Configuration file.", "Failed to Connect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
MessageBox.Show("Error connecting to the Server : \\n " + msg, "Failed to Connect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
finally
{
//conThread.Abort();
//Console.WriteLine("Thread ISAlive = " + conThread.IsAlive);
}
Console.WriteLine("Execution Completed ");
//**************
pri
>> Or: are you using the release version of the library in the app, and modifying the debug version? What do you mean ? I change the code in library and build it. The reference is added in main application. I build the main app, which updates the dll file and I execute the application. I checked the dll file date/time in main app, its of Release version of library. The library & app is in Release version. Should they be in Debug version ? How to change them ? The spacing must not be a problem as I copy from the output only and put in my if to look for indexOf. But yes, I think that applying BP on 1st line of Process_OutputDataReceived while execution helps. It got the "Cannot load file..." line and it went in isInvalid, went inside that if, changed "connected = false", and for the next line
else if (isInValidLine(d))
{
//throw new Exception(d);
connected = false; // MADE THIS
errorMsg = d; // EXECUTED THIS ALSO BUT AGAIN VALUE = ""
return;
}
private bool isInValidLine(string line)
{
if (line.IndexOf("Cannot load CA certificate file") > 0)
{
errorMsg = line; // EXECUTED THIS, BUT VALUE REMAINED ""
return true;
}
return false;
}
i GUESS i GOT TO debug more carefully. AND should I remove & add refernce everytime I buid the library ?
Thanks & Regards,
Hmm, the class that handles the conection is in a library. When i added break in Process_OutputDataReceived (before execution & while execution), the app doesn't print any Line on Console. I removed the break and tried again then it showed the LINE = on console. How to add breakpoint in a library class whose dll is included in main project. While degbuging the dll class comes normally and does the debugging. How to handle this ? Is it due to the class is in a library ?
Thanks & Regards,
Thanks OriginalGriff, I coded the foloowing : processInfo = new ProcessStartInfo("cmd.exe", "/C " + command); sb = new StringBuilder(); processInfo.UseShellExecute = false; processInfo.RedirectStandardOutput = true; processInfo.CreateNoWindow = true; process = Process.Start(processInfo); process.BeginOutputReadLine(); process.OutputDataReceived += new DataReceivedEventHandler(Process_OutputDataReceived); public string ErrorMessage { get { return errorMsg; } set { errorMsg = value; } } private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e) { errorMsg = ""; connected = false; string d = e.Data; if (!string.IsNullOrEmpty(d)) { if (sb != null) sb.Append(d + "\n"); Console.WriteLine("LINE = " + d); // I see each line if (d.IndexOf("Initialization Completed") > 0) { connected = true; Console.WriteLine("********* Connected = " + connected); } else if (isInValidLine(d)) { //throw new Exception(d); connected = false; errorMsg = d; return; } } } private bool isInValidLine(string line) { if (line.IndexOf("Cannot load file") > 0) { errorMsg = line; return true; } return false; }
The output that I see is : LINE = Thu Feb 03 17:22:28 2011 Cannot load file path (null) (SSL_CTX_load_verify_locations): error:02001002:system library:fopen:No such file or directory: error:2006D080:BIO routines:BIO_new_file:no such file: error:0B084002: Based on the above code and output, isInValidLine() should find the text "Cannot load file" and errorMsg should be set to the line and it should return true. My Implementation :
while (!oc.Connected)
{
timepassed = (int)(DateTime.Now - start).TotalMilliseconds;
if (timepassed > timeout)
{
oc.DisconnectServer();
connectedToVpn = false
I am tying to connect to server via cmd. Server keeps on giving output. Suppose the server gave output as : Trying to start ..... Cananot load file ..... Exiting OR Trying to start ..... Authenticating... Some thing ..... More.... Else,.......... keeps on going While retrieving the output, I want to check for lines like "Cannot find file", "Connected Successfully, etc and set properties ccordingly (like connected = true, errorMsg = "Cannot find file". Where I am calling the class, I can take care of those proeprties and stop if found connected == true or errorMsg.length > 0. With this inform the user that "Connection is achieved or error msg stating regarding "Cannot load file" and disconnect the server if errorMsg found. try { process = Process.Start(processInfo); process.BeginOutputReadLine(); I start the process, now got to check the output while the process is already running. That checking part am stuck up with. Process mostly wont Exit normally, I got to exit it. I mean just dir and got results ans process is exited - nothing like that. command keeps on giving output lines. To stop the server, I got to press "F4" on command prompt. How do I stop from here. Thanks & Regards,
Hello, I want to run a Command from command promt and want its output and maipulate its output. If required, want to close the process and display error or appropriate message. How is that possible. Any help is highly appreciated. I am stuck with this and would be glad if any body helps me solve my problem. Thanks Thanks & Regards,