|
Where does t come from ? If you create a class to contain s and t, then populate a list of them, you can make that the data source of your grid.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi im building a program in C# which downloads files , Ive wrote the code to generate the download graph and it works for values 30 - 100 but anyhing below 30 and the bar flips upside down .
I basically have 14 pixals to generate a bargraph of values 0 - 100 in . i know this is vague but im sure the problem is with GDI.FillRectangle(Graph, 1, 15 - Bar, 14, Bar - 1);
Can any ofr you c# gurus help me pinpoint the problem ()
private Graphics GDI;
private Bitmap DownloadGraphic;
private Icon icon;
private int value = 5;
public void DownloadGraph()
{
int Bar = (14 * value) / 100;
DownloadGraphic = new Bitmap(16, 16);
GDI = Graphics.FromImage(DownloadGraphic);
SolidBrush BackgroundBrush = new SolidBrush(Color.Transparent);
GDI.FillRectangle(BackgroundBrush, 0, 0, 16, 16);
Pen LeftBorder = new Pen(Color.White, 1);
GDI.DrawLine(LeftBorder, 15, 0, 15, 15);
GDI.DrawLine(LeftBorder, 15, 15, 0, 15);
Pen RightBorder = new Pen(Color.Gray, 1);
GDI.DrawLine(RightBorder, 0, 16, 0, 0);
GDI.DrawLine(RightBorder, 0, 0, 16, 0);
SolidBrush Graph = new SolidBrush(Color.DarkRed);
GDI.FillRectangle(Graph, 1, 15 - Bar, 14, Bar - 1);
Pen DownloadHilight = new Pen(Color.OrangeRed, 1);
GDI.DrawLine(DownloadHilight, 1, Bar, 14, Bar);
Font PercentFont = new System.Drawing.Font("Verdana", 7, FontStyle.Italic);
Brush Percentage = new SolidBrush(Color.White);
GDI.DrawString(value.ToString(), PercentFont, Percentage, 0, 1);
this.NotifyIcon.Icon = Icon.FromHandle(DownloadGraphic.GetHicon());
}
Thanks
|
|
|
|
|
Your code seems to work fine here - just your OrangeRed bar moves down as the rectagle gets bigger from the bottom - which looks a bit strange, but it is what your code asks.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi im new to c# and im building a program to telnet my server. Im trying to prevent the situation below
HostName> A command that will take a long time
The next command HostName>
Where the application sends the next command before the server has completed the last one .
Here is my code
public void Run(string cmd)
{
System.Threading.Thread.Sleep(300);
string lastCharacter = Status.Substring(Status.Length - 2, 1);
if (lastCharacter == ">")
{
WriteLine(cmd + "\n");
}
else
{
Run(cmd);
}
}
I want to get rid of the System.Threading.Thread.Sleep(); functions because they are a major source of exceptions in the program . Is there anyway to solve this problem without System.Threading.Thread.Sleep() and withut sucking up all the CPU time ?
|
|
|
|
|
I have a thread reading the responses and it doesn't signal the sending code until it sees the expected response.
This is done in a telnet scripting class I wrote, but which is not yet ready for distribution.
|
|
|
|
|
Hi everybody, im trying to execute a .jar file in my c# program, i have try several times and get examples, but i can't do it.
I execute in the cmd, like this
java -Xms60m -Xmx256m -jar C:\\Programming\\Interface.jar";
and this open the program.
But, trying with the Process class:
Process process = new Process();
System.Diagnostics.ProcessStartInfo procInfo =
new System.Diagnostics.ProcessStartInfo("java -Xms60m -Xmx256m -jar C:\\Programming\\Interface.jar");
process = System.Diagnostics.Process.Start(procInfo);
and other instructions, i get an exception, the file can't be found.
Some one knows??
Thanks in advance.
|
|
|
|
|
If you would read the parameter's name, you would see that it's called fileName, therefore - there is no file name called "java -Xm......". Try
<br />
Process proc = Process.Start("java", "-Xms60m...."); <br />
Also, make you that java exec is in your env path, otherwise supply full path to it.
|
|
|
|
|
Thanks for the answer dude, but it's not working still, i dont get an exception, just a ms-dos window for a second.
Process proc = Process.Start("java",
"java -Xms60m -Xmx256m -jar C:\\Programming\\Interface.jar");
proc.EnableRaisingEvents = false;
proc.WaitForExit();
Have i write it correctly? I really don't understand why waitForExit is neither working..
|
|
|
|
|
FINALLY IS WORKING!!! Here is the code, thanks for ur time..
string path = "C:\\Programming";
Process process = new Process();
process.EnableRaisingEvents = false;
process.StartInfo.FileName = "java.exe";
process.StartInfo.Arguments = "-jar " + '"' + path+ "\\interface.jar";
process.Start();
|
|
|
|
|
Hi,
Use the following code to run .jar file from c#
private int ExecuteProcess(string cmd, string cmdParams, string workingDirectory, int timeout, out string stdOutput)
{
using (Process process = Process.Start(new ProcessStartInfo(cmd, cmdParams)))
{
process.StartInfo.WorkingDirectory = workingDirectory;
//process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
stdOutput = process.StandardOutput.ReadToEnd();
process.WaitForExit(timeout);
return process.ExitCode;
}
}
string stdOutput;
string parameters = "Prajwal";
int exitCode = ExecuteProcess(@"C:\Program Files\Java\jre1.6.0\bin\Java.exe", " -jar samplejarfilename.jar " + parameters
,path, 5000, out stdOutput );
|
|
|
|
|
Dear All,
I have 2 problems with the software I am devoloping.
1. Through data reader it gets data from As400 and inserts it into a local database. I have label that is supposed to notify regarding the status of the process. But its text does not change at all untill data is inserted into local access file. There are several commands to change the text between.
2. Do you have any idea how to get the completion rate of the inserting process?
Thanks in advance
|
|
|
|
|
Ersan Ercek wrote: There are several commands to change the text between
Are you changing th text using a seperate thread?
Ersan Ercek wrote: Do you have any idea how to get the completion rate of the inserting process?
Well, there is nothing as such which can tell you the exact rate of completion, but you may simulate it taking the average of some attempts.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Are you changing the text using a seperate thread?
I did not understand what you mean excatly but here are sample codes.
con.ConnectionString = "Driver={Client Access ODBC Driver (32-bit)};System=xxxx;Uid=xxxxx;Pwd=xxxxxxx";
try
{
con.Open();
cmd = new OdbcCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
lblStatus.Text = "Starting Select Process";
cmd.CommandText = "Select Article, Store, Month, Year, Day, SUM(UD) AS UNIT, " +
"SUM(Value) AS VALUE from Data" +
" Where Year="+txtYil.Text+" AND Month= "+txtAy.Text+" AND Day BETWEEN "+
txtBaslangic.Text+" AND "+txtBitis.Text+
"GROUP BY Article, Store, Month, Year, Day";
cmd.CommandTimeout = 0;
lblStatus.Text = "Data is being selected";
dr = cmd.ExecuteReader();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
lblStatus.Text = "Data is being inserted to Access";
oleCon = u.oleCon("NXAC"+txtYil.Text+txtAy.Text+".mdb");
oleCon.Open();
while (dr.Read())
{
if (olecmd != null)
{
olecmd.Dispose();
}
olecmd = new OleDbCommand();
olecmd.Connection = oleCon;
olecmd.CommandType = CommandType.Text;
|
|
|
|
|
try calling...
this.Refresh();
after each text update, this is a quick fix.
I would suggest you look into the BackgroundWorker component for a better solution
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I went for Background worker, it is a great solution.
Thanks alot.
|
|
|
|
|
I want to send Email in Arabic ;
I have used genaral SmtpMail class to send email,.. but when i send Arabic text email it shows like '?????????' for the all text;
i did objMsg.BodyFormat = MailFormat.Html; also but no Luck.
There are many ActiveX,.Component available,..
But i want to know in using .Net class same SMTP;
If any body know plz tell me;
Your corperation is appreciated!
B/rgs
Anushka
|
|
|
|
|
try using
mailMessage.BodyEncoding = Encoding.Unicode;
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I've used
theMessage.BodyEncoding = Encoding.UTF8;<br />
Is using Encoding.Unicode better for Arabic than Encoding.UTF8 ?
Regards,
Gary
|
|
|
|
|
Hi
I'm trying to add a web reference to my windows app, but .net is not allowing this, i'm getting the following error Operation is not valid due to the current state of the object., i understand that this has to do with proxy, how do i solve his problem, my browser opens the web service without a problem
thanx in advance
|
|
|
|
|
try this in your application's web config/ app config and add the following under the <configuration> element:
<system.net>
<defaultProxy>
<proxy usesystemdefault="True" proxyaddress=http:
</defaultProxy>
</system.net>
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
i tried that it doesn't seem to be working.
|
|
|
|
|
Google and I were not friends today, so I ask you guys here!
This project has GridView control and MenuStrip which is set in grid's ContextMenuStrip to pop up when user is pressing right mouse button over the grid.
When user is pressing right mouse button over GridView the current row is not automatically set to the row "under" mouse pointer.
How is it possible to change current row (focus on) to the row under mouse pointer at that point before toolstrip menu is shown?
|
|
|
|
|
Raybarg wrote: How is it possible to change current row (focus on) to the row under mouse pointer at that point before toolstrip menu is shown?
It may not be. Without looking at the Grid documentation I would guess, like other controls, you can determine the row based on the mouse pointer coordinates.
Keep in mind this is a complete guess on my part and if I am wrong someone else will likely reply to you with the correct solution.
|
|
|
|
|
In the cell mouse down event open your context menu rather than using the built in context menu property.
|
|
|
|
|
The row is selected on the left mouse down.
while in your case, you do a right mouse click to show the menu strip.
You can instead fake this in the OnCellMouseClickEvent
if (e.Button == MouseButtons.Right)
{
if(this.datagridview1.SelectedRows.Count > 0)
this.datagridview1.SelectedRows[0].Selected = false;
this.datagridview1.Rows[e.RowIndex].Selected = true;
}
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|