|
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...
|
|
|
|
|
Hi,
i dont think there is a direct way to assign CTRL combination to command button. but you can always use the ALT+ combination by just typing the "&" before the character in the button text property.
if you anyway want to give CTRL combination or F9 like shortcut key you can use the form keydown event and check for the key combination pressed and raise the button_click event manually.
Hope this works.
Nitin...
|
|
|
|
|
Hello
Handle the KeyUp event in all possible control that would receive this combination. you can point them all to one event handler BTW.
Then in that event handler check for the combination. If true call MyToolStripButton.PerformClick() method, or use a common method to do the job.
Regards
|
|
|
|
|
I have multiple separate XSD files and I need to create classes from them using the xsd.exe tool.
Problem is that the class files created by the tool all use the same nomenclature, and so they all conflict with each other with "Already Defined" errors.
How can I create classes for all of my XSD schemas so that they all coexist in the same project?
Thanks,
Rich
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I apologize for posting this questions in two forums, but I feel it pertains to both the .net framework and c#
Hello everybody, I am writing a program in c# for logging/analyzing purposes and am trying to access the information located in another applications datagrid. I figured out how to use the winapi and sendmessage to get text from textboxes, comboboxes, listboxes, etc... but cannot seem to find anything about getting text/info from a datagrid. Is it even possible? I searched msdn for datagrid SendMessage information and nothing of significance was available.
Thanks
|
|
|
|
|
I have a radiobutton(RB1) and a FileUpload server control(FU1) on my page.
if(RB1.Checked == true && (!FU1.HasFile))
{
MessageBox.Show("You must select a file to upload");
FU1.Focus;
}
If the user has checked the radiobutton but not selected any file to upload then I would like to display an error message using MessageBox and bring the focus to FU1 and let the user select the file to upload. I donot want to execute the rest of the code until the user selects the file to uplaod.
Is there a way to do this?
Thanks in Advance,
vct
|
|
|
|
|
Use "else".
---
b { font-weight: normal; }
|
|
|
|
|
Can't a return statement be also used in that circumstance?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Yes, it can.
The reason one might not want to use a return statement, is to keep the single exit point of the method.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I think u can use while loop instead of if statement. thats what i understood from ur code.
POOJA
|
|
|
|
|
No, that will not return control to the user. You have to exit from the event so that the user can change the input.
---
b { font-weight: normal; }
|
|
|
|
|
oh ya...... application.doevents can be used i think bt leave it.
do u have some button click event...... i mean when do u check for file present. If u have such event then in that event u can simply use if and else statement.
POOJA
|
|
|
|
|
Hello,
In your case the ShowDialog Method would be better.
You should create a YourMessageBox class, which inherits from windows.forms.
There you can implement a fileselection, okbutton and exitbutton.
If there is no file selected the okbutton is not enabled.
YourMessageBox class can then implement a Filename property (public), which is set if a File was selected.
At the Button Click Events:
private void okbutton_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Exit();
}
private void exitbutton_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Exit();
}
Code for the class who calls the messagebox:
YourMessageBox mb = new YourMessageBox();
if(mb.ShowDialog() == DialogResult.OK)
{
//mb.Filename
//Do the rest of the code
}
Hope that helps.
All the best,
Martin
|
|
|
|
|
Hello,
I have just found the custom-written event in C# needs to have at least one client registered to consume the event or else the application will crash. Why this is so? This means that if I unregister all the client methods from the event during the time the application is running and then the event occurs, it will crash. Or am I missing something?
Evidence that this is so - test bench program:
using System;
namespace EventsTest
{
public delegate void FirstEventHandler();
public delegate void SecondEventHandler();
public class EventsClass
{
public event FirstEventHandler FirstEvent;
public event SecondEventHandler SecondEvent;
private void FireOffFirstEvent()
{
FirstEvent();
}
private void FireOffSecondEvent()
{
SecondEvent();
}
public void FireOffAllEvents()
{
FireOffFirstEvent();
FireOffSecondEvent();
}
}
public class EntryClass
{
static void Main()
{
EventsClass MyEvents = new EventsClass();
string MyChoice;
do
{
Console.Write("Do you wish to register the event clients to the events? (y/n): ");
MyChoice = Console.ReadLine();
} while (MyChoice != "y" && MyChoice != "n");
switch (MyChoice)
{
case "y":
MyEvents.FirstEvent += new FirstEventHandler(FirstEventClient);
Console.WriteLine("First event registered.");
MyEvents.SecondEvent += new SecondEventHandler(SecondEventClient);
Console.WriteLine("Second event registered.");
break;
case "n":
Console.WriteLine("No events registered.");
break;
}
Console.WriteLine("Firing off all events..");
MyEvents.FireOffAllEvents();
Console.WriteLine("Press enter to continue..");
Console.ReadLine();
}
static void FirstEventClient()
{
Console.WriteLine("First event processed successfully.");
}
static void SecondEventClient()
{
Console.WriteLine("Second event processed successfully.");
}
}
}
C# source and compiled exe attached below.
Any comments on this weird behavior?
Michal
Seems like it's not possible to attach a file here, so you can download the .cs file here: http://kreslik.com/forums/viewtopic.php?t=231[^]
|
|
|
|
|
From the code, it looks like you should be getting an unhandled null reference exception in FireOffFirstEvent() when you do not register the events. This is correct.
When you create the instance of EventsClass, FirstEvent is null. If you do not register the events it is never set.
You call FireOffAllEvents()
which calls FireOffFirstEvent()
which calls FirstEvent() - which is null
One way to solve this is place a check around the delegate invocation, e.g.
private void FireOffFirstEvent() {
if (null != FirstEvent) {
FirstEvent();
}
}
Q.
|
|
|
|
|
OK. But then why there's not the same problem with not registering all the built-in events that come with, say, a windows form?
Does that mean that VisualStudio doesn't even declare these events until I use them and register them?
Michal
|
|
|
|