|
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.
|
|
|
|
|
Hello
You could create a property of the enum1 type
public enum enum1{ f1=0, f2=1, f3=2, f4=3}
private enum1 myEnum1;
public enum1 MyEnum1
{
get ( return myEnum1; }
set
{
if (value == f1 || value == f3)
myEnum1 = value;
else
throw new ArgumentException("Invalid assignment");
}
}
Otherwise you could create different enums
public enum enum1{ f2=1, f4=3}
public enum enum2{ f1=0, f3=2}
for example.
Kind Regards,
John Petersen
|
|
|
|
|
Thank you very much. And from your side i desires for welcome.
|
|
|
|
|
If you intend the enum to allow for OR'd combinations as you imply, you should decorate the enum with the Flags[^] attribute.
This attribute indicates that an enumeration can be treated as a bit field; that is, a set of flags. Bit fields can be combined using a bitwise OR operation, whereas enumerated constants cannot.
Bit fields are generally used for lists of elements that might occur in combination, whereas enumeration constants are generally used for lists of mutually exclusive elements. Therefore, bit fields are designed to be combined with a bitwise OR operation to generate unnamed values, whereas enumerated constants are not. Languages vary in their use of bit fields compared to enumeration constants.
Your code will compile without the Flags attribute, but it helps the compiler, the runtime and other developers understand how the enum is supposed to be used.
|
|
|
|
|
In a method i have two strings first is a property name i.e. "Text" and second is its value "MyName" as well as I have a control on my web form i.e. TextBox1 now on the basis of given string how can I set the TextBox1.Text = "MyName". The problem is I didn't found any property collection with control object and through reflection i can access properties but in that case those were not attached with a perticular control. How can I map the Text property of TextBox control through string "Text"???
|
|
|
|
|
Hi,
I have a lil question about how to change te way the program handle things.
I have a device attached to my serial port.
Thi device can take several commands, and it returns something back which i can read on the screen. But after every command i send to the device, there should be a thread.sleep(1000).
Since i send alot of commands automatically to the device, i rather want it to wait till it gets the info and then send it back.
Because the sleep(1000) isnt always enough. Sometimes it needs a lil more time to reply.
So i want to make an event handler which waits for a reply and than continue.
This is a peace of the code how it looks like:
serialPort = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
serialPort.Write(command);
Thread.Sleep(1000);
serialPort.Write(command);
Thread.Sleep(1000);
serialPort.Write(command);
Thread.Sleep(1000);
serialPort.Write(command);
Thread.Sleep(1000);
Can someone help me how to make an event handler for this?
Thanks in advance!
|
|
|
|
|
Hi,
In Visual Studio 2005 the serial port control has events. And one of them is DataReceived. Try using that event.
Do your best to be the best
|
|
|
|
|
Hi
I think that you can use AsyncCallBackDelegate to do what you want.This way you can run a command Asynchronously and when its done you callback delegate will be executed.You can have a delegate to run your command and in its BeginInvoke moethod you will pass a AsyncCallBackDelegate.
Regards
|
|
|
|
|
hi,
i want to read the properties of a document ,i am able to read the proerties using built in proerties and dso file also but i want to read only statistical properties of a document . the path for the statistical properties in a word document.
1.click on file property of a word document.
2.then click on properties
3.then a pop up window is opened and select the statistic tab
and i want to read those properties .
please let me know if any of you worked on these properties.
jrsreenivas@gmail.com
jrsreenivas
|
|
|
|
|
Hi,
try using microsoft word object library and create object of word application,and open a specified in the document object. There are many properties available in this library about word document. try using them.
hope this works.
Nitin...
|
|
|
|
|
i am sending matlab code,can some one help me to convert this code into C#,
imagex=imread('D:\MS_courses\ece655\Project\test_images\test_image3.jpg');
%RGB2GRAY converts RGB images to grayscale by eliminating the
%hue and saturation information while retaining the luminance.
%im2double takes an image as input, and returns an image of class double.
f = im2double(rgb2gray(imagex));
%f=[.1,.2,.3;.4,.5,.6;.7,.8,.9];
%Storing the number of rows and columns in separate output variables
[sizeM, sizeN] = size(f);
%Counter is used just to check the status of the program at all times.
counter = 0;
%for k=1:1:256
%gvalue_f(k) = 0;
%gvalue_N(k) = 0;
%end
%--------------------------------------------------------------------------
%This loops makes a window of 3*3 and scans over the image from left to
%right and top to bottom to get those pixel values that are most probably
%a function of Impulse, called Nimp.
for x=2:1:(sizeM-1)
for y=2:1:(sizeN-1)
k = x;
l = y;
x1 = f(k-1, l-1); x2 = f(k-1, l); x3 = f(k-1, l+1);
x4 = f(k, l-1); x5 = f(k, l); x6 = f(k, l+1);
x7 = f(k+1, l-1); x8 = f(k+1, l); x9 = f(k+1, l+1);
W = [x1,x2,x3,x4,x5,x6,x7,x8,x9];
x_sum = 0;
count = 0;
x_temp = 0;
wind(1,1) = W(1);
wind(1,2) = W(2);
wind(1,3) = W(3);
wind(2,1) = W(4);
wind(2,2) = W(5);
wind(2,3) = W(6);
wind(3,1) = W(7);
wind(3,2) = W(8);
wind(3,3) = W(9);
for m=1:1:3
for n=1:1:3
x_temp = wind(m,n);
if((x_temp == min(W)) | (x_temp == max(W)))% | (x_temp <= 10) | (x_temp >= 230))
Nimp_sub(m, n) = x_temp;
else
count = count + 1;
x_sum = x_sum + x_temp;
Nimp_sub(m, n) = 0;
end
end
end
%Nimp=size(f);
Nimp(k-1:k+1,l-1:l+1) = Nimp_sub;
counter = counter + 1
end
end
%for k=2:1:sizeM-1
% for k=2:1:sizeN-1
% gvalue_f(f(k, l)) = gvalue_f(f(k, l)) + 1;
% Nimp_db = im2uint8(Nimp(k, l)) + 1;
% gvalue_N(Nimp_db(k, l)) = gvalue_N(Nimp_db(k, l)) + 1;
%end
%end
%Calculating the histograms of input image and Nimp (those pixels in the image
%which are most probably members of impulse noise).
temp_hist_f = hist(f, 256);
temp_hist_imp = hist(Nimp, 256);
for i=1:1:256
hist_f(i) = sum(temp_hist_f(i, );
hist_imp(i) = sum(temp_hist_imp(i, );
end
%Calculating the estimated histogram (est_hist) by first finding the difference
%b/w the input image histogram and Nimp histogram. And then dividing the
%difference from the sum of differences called temp_sum.
temp_sum = 0;
%temp_hist = (hist(f) - hist(Nimp))/(-1 * temp(1,1))
for i=1:1:256
temp(i) = abs(hist_f(i) - hist_imp(i));
%temp_sum = temp_sum + temp(i);
end
temp_sum = sum(temp);
for i=1:1:256
est_hist(i) = temp(i) / temp_sum;
end
imshow(imagex);
title('Original Image');
figure;
imhist(imagex);
title('Histogram of Noise Added Image');
figure;
imhist(Nimp);
title('Impulse Histogram of Noise Added Image');
figure;
|
|
|
|
|
I dont think there are someone being kind enough to convert the code
for you as the task will take about 1 to a few days.
Instead you may learn C# (easy to pick up) and diy
|
|
|
|
|
Hi...
Am having a java project which i have to now convert to a .NET project.
I tried to develop an j#.NET project and implement the logic in this project.
My project is all about images ,so i need to import javax.swing.*.But i couldnt do it.I am able import java namespace.
WHy is it so?How can i create swing applications?[i found a sample app in http://msdn2.microsoft.com/en-us/library/96etzbdw.aspx[^]but i couldnt find the dll specified there to be added as reference]
Also pardon if this is not the right place to post the forums of j# and kindly redirect me to appropriate forum topic.
Thanx
|
|
|
|
|
i even dont know why J# exists. it was born after a fight between MS and SUN.
why dont you think about rewriting this project in C#? you`ll learn a new and neat language (if you still dont know yet). Besides, C# and Java are very similar with each other.
|
|
|
|
|
You're really better off with C#.
J# is just a handicapped version of C#. J# has extremely close syntax, but fewer features.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Clear VB: Cleans up VB.NET code
C# Code Metrics: Quick metrics for C#
|
|
|
|
|
Hi
Thanks for your valuable idea.
Am working with image processing.
So could you please tell me any valuable site that can help me more about images, because i already tried it in c# but in vain[am a beginner to c#]
hopefully expecting your help...
Thanx..
|
|
|
|
|
Dear all,
I am trying to find the easiest way to give a keyboard shortcut to a command button like CTRL+K or F9 etc. Can i also give the shortcut key to ToolStripButton? How?
Thanks...
|
|
|
|
|