|
I implemented your idea, but now nothing happens :<
private void Charges_Paint(object sender, PaintEventArgs e)
{
if (!isPainting)
{
isPainting = true;
if (activeParticles < 1)
return;
Pen myPen = new Pen(Color.FromArgb(128, 0, 0, 0), 2.0f);
for (int i = 0; i < activeParticles; i++)
{
if (myParticles[i].Charge)
myPen.Color = Color.FromArgb(128, 255, 0, 0);
else
myPen.Color = Color.FromArgb(128, 0, 0, 255);
e.Graphics.DrawCurve(myPen, myParticles[i].GetCurve());
}
myPen.Dispose();
isPainting = false;
}
}
-- modified at 9:37 Thursday 31st August, 2006
|
|
|
|
|
Hello,
Sorry but I don't get your 'if' statement here.
if(!isPainting)
{
isPainting = true
//I think, here should be youre code
}
else
{
}
isPainting = false;
All the best,
MArtin
|
|
|
|
|
SharpenedC wrote: myParticles[i].GetCurve()
That is returning incorrect data. Check the values returned from that call when it crashes, you will likely spot a logic error
|
|
|
|
|
Hi. I am new to the programming bussiness. I have a urgent question.I am still working on .net 2003. When i am on a windows form, and run a select statement from sql to retrieve data, about 5000 records, the app is displaying in the task manager - "Not Responding" and it is opening a new instance of that. When it has retrieved the data, it is then running again and the other instance dissapears. Can smeone please help. This app must write about 50 000 records in to sql in one stage after it has checked in the db for duplications, and cannot display that it is not responding.
Thanks
|
|
|
|
|
Hi
Usually a program runs in a sequential manner (in a single thread) it means that each line of code should be executed and returns before the program flow can proceed.
Sometimes it takes some time for a command to be executed ( like you said,when a SQL statement is executing) and since your program is waiting (busy) during this operation if you want to ask its status using Task Manager,you will get "Not responding"
there are some ways that you can avoid this situation.
You can execute a command Asynchronously ( in another thread.)
This way your command will be executed in another thread (sequence of program flow) and you will be notified when the command execution is ended.
Regards
|
|
|
|
|
Hello,
i'm creating a custom control derived from the textbox class. The user must not be able to set focus on the textbox so i want to do it like this:
bool noFocus = true;<br />
<br />
protected override void OnEnter(EventArgs e)<br />
{<br />
if (noFocus == true)<br />
{<br />
}<br />
}
which code should I write after the comment tags?
Kind regards,
Frederik
|
|
|
|
|
hi
try to make the textbox disable.
Tamimi - Code
|
|
|
|
|
-> if the user cannot focus the textbox, why not set the ReadOnly textbox property to true?
-> you can also set the focus to another control you want in this code snippet, for instance.
good luck
|
|
|
|
|
Hi
As far as I know you can not force a custom control to lose focus but you can notify its container that it can gain the focus (by making it deisable or readonly ) or you can throw an exception when your text box is getting the focus.
for example:
<br />
protected override void OnEnter(EventArgs e)<br />
{<br />
if(noFocus)<br />
throw new MyTextBoxCantGetFocusException();<br />
}<br />
then you can manage the focus in your container
Regards
|
|
|
|
|
I Found the solution:
bool noFocus = true;<br />
<br />
protected override void OnEnter(EventArgs e)<br />
{<br />
if (noFocus == true)<br />
{<br />
int index = Parent.Controls.IndexOf(this);<br />
Parent.Controls[index - 1].Focus();<br />
}<br />
}
|
|
|
|
|
Goerlandt wrote: int index = Parent.Controls.IndexOf(this);
Parent.Controls[index - 1].Focus();
Hello,
Be carefull if index is "0".
All the best,
Martin
|
|
|
|
|
Hi all,
I am creating a form and in which, the user should have an option to insert symbols in the text box. The symbols include Greek symbols, standard mathematical operators and others stuff. How could i make a user interface such that user selects a symbol from the pop-up window, so the selected symbol value should return into the text box.
|
|
|
|
|
Hi everyone
I am trying to export data from datagrid to excel but gives me this erro"Obect reference not set to instance of the object".here is my code.I am using windows C#.
lblMessage.Text = "";
DataTable dtTransactions = dsTransactions.Tables["Transactions"].Copy();
int[] iColumns = {0,1,2,3,5,6};
RKLib.ExportData.Export objExport = new RKLib.ExportData.Export("Win");
objExport.ExportDetails(dtTransactions,iColumns,Export.ExportFormat.Excel,"C:\\TransactionsInfo.Excel");
lblMessage.Text = "Successfully exported to C:\\TransactionsInfo.Excel";
-- modified at 8:28 Thursday 31st August, 2006
|
|
|
|
|
Response.Clear();
Response.Charset = "";
Response.AddHeader("content-isposition", "attachment;filename=FileName.xls");
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGrid dGrid = new DataGrid();
dGrid.DataSource = Classname.functionname();//this is where u write the stored procedure
dGrid.HeaderStyle.Font.Bold = true;
dGrid.DataBind();
dGrid.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
please help me
|
|
|
|
|
Hi all,
This is hard to explain but I need some sort of Algorythm that will calculate a number for me.
Basically, I am "trying" to build a class that will output a Graph for our web stats, within my code I have got the highest amount that will be shown on the graph, and now I need to set the Y Axis values.
So at the moment, I have the values 0,2,0,90,172
because the highest value is 172 i'd like to some how generate a set of numbers like the following:
0,30,60,90,120,150,180
But since these values constantly change, I need some fancy way of calculating them.
Anyone have any idea's?
The reason why I ask, is because the Graph size will be 200hx700w (pixels) and regardless of the
results I want them to fit without any further coding.
Thanks
Gav
|
|
|
|
|
Gavin Roberts wrote: because the highest value is 172 i'd like to some how generate a set of numbers like the following:
0,30,60,90,120,150,180
Round the highest number to be a multiple of 10, and then create a set with n steps with: number / n
Example:
highest value = 154
-> maxnumber = (int)(154 / 10) * 100 + 10
(But this will only work reliable in the range of 10-100 - I can write an algorithm for you that will work on any kind of numbers, up to a million and above, but I have no time right now. I might write it later for you if you need it )
steps: n steps (e.g. 5)
-> step = maxnumber / n
then you can create your steps like this:
0, step, 2*step, 3*step, ... maxnumber
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
if I understood the question correctly:
take the highest number (in our example its 172) and do the following:
172 / 10 = 17.2 -- but if it is "int" we will get --> 17
17 + 1 = 18 // add 1
18 * 10 = 180 // multiple by 10
and you rounded up the heighest number.
so the algorithm is:
roundUP(int x)
{
int result;
result = x/10;
result++;
result*=10;
if(result > 200)
result = 200;
return result;
}
it seems to me a pretty efficint way to calculate, unless I didn't understand the question.
hope it helps!
|
|
|
|
|
There is an article here on Codeproject presenting A flexible charting library for .NET[^] that implements the described behaviour. Either use this library or take a look at the source code to see how the autoscaling is accomplished.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
Hi guys
I need small help regarding the datagrid.
I need to send data from one ane datagrid to another datagrid by clicking the button from first datagrid to a particular record.
In my first grid i had a text box where i need to enter the integer value in that text box.
So plz let me if any one did this.
please help me
|
|
|
|
|
Hi
Would you please explain your senario a little bit more.I can't get it.
I think that you have a list of enities( say products) and want to add it as a piece of information into another list (say an order items list) and then enter its amount.
If that's the senario let me know
Thnaks
|
|
|
|
|
I have a datagrid in which all menu items are there,in that i ll give the quantity in textbox which is located in datagrid. so when i click add button then that menitem & quantity should be added in another datagrid.
This is my request sir.
Thanking u,
Regards,
Naren.
please help me
|
|
|
|
|
hi guys
i wanna develop a application in c# for my pocket PC to call telecommunication services like (check the balance, summary, and other services which is provided by telecommunication), now what i doing when ever i want to check the balance summary i have to dial the service center No., to solve this problem i will configure everything in my application on time whenever i want i can use my application for those feature, no need to dial
so please solve this problem if any one know about the above mentioned subject
raj
project leader
India
code
-- modified at 8:53 Sunday 3rd September, 2006
code
-- modified at 8:54 Sunday 3rd September, 2006
<
|
|
|
|
|
I think TAPI is helpfull to you.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
I have an enum say enum1. It has four fields f1,f2,f3,f4. I have allowed this to be set with multiple values. The enum1 is shown bellow:
public enum enum1
{
f1=0,
f2=1,
f3=2,
f4=3
}
But this allows enum with any combination of values to be set. I want this enum with particular restricted combination (say f1|f2,f2|f3, and f1|f4 only) to be set. How can i accomplish that?
Thanks.
|
|
|
|