|
I known 2 ways.
1 is regex
2 is use string.split(' ') splite the phrase to a string[].
wang
|
|
|
|
|
I assume that you mean that you want to get the text out of Word and manipulate it in some way. There is a way that doesn't involve using Microsoft Word at all, and relies instead on something called an IFilter. Basically, an IFilter is the mechanism by which the Search mechanism in Windows works, and allows you to get information out of sources such as Excel, Word, Adobe Acrobat, etc.
What you need to do is read in the document using the appropriate IFilter and then parse it to extract the words. Here's a link to a C# version that shows what you need to do.
http://www.codeproject.com/csharp/IFilter.asp[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I am using a MenuStrip Component in .NET 2.0, Windows form Application. How do you capture the events on the individual items, when they are clicked
Lets
Home
> SubItem1
> SubItem2
> SubItem3
ItemClicked event on the MenuStrip component triggers when the Top level Menu items are clicked like Home
How do you find out which subitem was clicked.
Thanks
Rajaraman.S
|
|
|
|
|
Hi !
I'm using Visual Studio 2005 Professional Edition and C#.
I have a simple question:
I want to add to my form, which is a scrollable control, a menustrip and
statusstrip.
The problem is that the menustrip is not fixed at top if i scroll down.
A similar problem exists also for the statusstrip. If i open the program it
is only visible if i scroll down.
The program thinks that the menustrip and the statusstrip are in the Client
region, to which i want to draw something.
So, how can I fix them, so that they are not get lost if i scroll the main
form up or down ?
--
Schwammkopf
PS: The AutoScrollMinSize is set to (ClientSize.Width + 50,
ClientSize.Height + 50). Of course, on each OnPaint i update it.
|
|
|
|
|
hi, im trying to use GetProcesses(); function to list all active processes in my machine, i want to use this function to use DuplicateHandle to list the handles of a specific process...
but i cant find no where information that could me let write the prog, mos of the cases all examples give me errors, in microsoft MSDN i dont understand i they use #using then the compiler give me errors... im confuse with using GetProcesses(); or GetCurrentProcess(); but with both i cant write the prog, full of errors...
please someone could give me a had here...
|
|
|
|
|
This is the code that I use.
Dim YourProcesses() As Diagnostics.Process
Dim currentProcess As Diagnostics.Process = Diagnostics.Process.GetCurrentProcess()
YourProcesses = Diagnostics.Process.GetProcessesByName("YourAppNameHere")
If UBound(YourProcesses) > 0 Then
If currentProcess.Id <> YourProcesses(0).Id Then
MsgBox("Previous Instance of Your Application is already Running", MsgBoxStyle.Exclamation, "Your Application")
End
End If
End If
|
|
|
|
|
Here is some C# code from a big app, it may contain some strange lines (just ignore
those), it is copied here to show the general flow:
using System.Diagnostics;
public static ProcessComparer processComparer=new ProcessComparer();
public void showComboboxWithAllProcessesInAlphabeticalOrderAndMinePreselected() {
LP_SimpleDialog dialog=new LP_SimpleDialog("Show Process", settings);
Process[] processes=Process.GetProcesses();
int n=processes.Length;
ArrayList processes2=new ArrayList();
for (int i=0; i<n; i++) processes2.Add(processes[i]);
processes2.Sort(processComparer);
string[] procnames=new string[n];
int myProcID=Process.GetCurrentProcess().Id;
int curr=0;
for (int i=0; i<n; i++) {
Process proci=(Process)processes2[i];
if (proci.Id==myProcID) curr=i;
procnames[i]=proci.ProcessName;
}
ComboBox cb=dialog.AddFixedComboBox(procnames, curr);
}
public class ProcessComparer : IComparer {
public int Compare(object object1, object object2) {
Process process1=object1 as Process;
Process process2=object2 as Process;
return string.Compare(process1.ProcessName,
process2.ProcessName, true);
}
}
Hope this helps.
Luc Pattyn
|
|
|
|
|
Has anyone ever tried to use the Text Object Model[^] with a RichTextBox? Personally, I like the TOM much more than the manipulations allowed through normal interaction with the RichTextBox but I just can't seem to find any way to get to ITextDocument in .NET.
Has anyone ever attempted this before and lived to tell the tale? I doubt that I'm the only person who ever wanted a DOM for rich text in a .NET app...
|
|
|
|
|
There's an article here on CP that might help. This is the link Clickety[^] to the message that talks about using ITextDocument.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks! Seems just what I need.
|
|
|
|
|
Hello All !!!
Tell me please - how in .NET 2005 set total control for mailslot (function CreateMailSlot) for everyone.
Is it necessary set DACL in null ?
I am trying but there is no results...
If anybody uses securuty in .NET 2005 please help
|
|
|
|
|
Hi there,
I just wanted to know whether it was possible to create postscript file from doc, xls and ppt using .net framework. I am going crazy trying to find answer to this problem so at this point any help would be greatly appreciated.
|
|
|
|
|
Well, no. .NET cannot write a postscript file using built in libraries, nor can it read Office docs without the Office toolkit also installed.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
So if this is not possible using using .net framework's built in library. Is there any other way this can be done.
|
|
|
|
|
Hi Friends,
In my project i set the session expire after 20 min. But it donot take that much time, the session is expiring with in 5 min or 10 min or expiring when am working on it, can anyone tell what i can do for solve this problem?
thanks & rgds
Nithin
|
|
|
|
|
Nithin Krishna wrote: In my project i set the session expire after 20 min. But it donot take that much time, the session is expiring with in 5 min or 10 min or expiring when am working on it, can anyone tell what i can do for solve this problem?
I had a similar problem in one of site.It was caused by too much stress on the domain. This could be one reason your session is expire before 20 min.
Other reason could be configuration setting in the web file.
|
|
|
|
|
this happens only when there is lot of data to be loaded in the page.Simplify the queries and use stored procedures.
cheers
sangeet
|
|
|
|
|
I have my C# project which runs on a PDA device. How to I check on the device which version of OpenNetCF it is using.I mean which file to check for and on which location on the PDA? Or is it only on the local machine on which I compile my code. But I see that a code which I have compiled on my machine, runs well on one PDA, but does not on the other PDA and gives the following exception
"An unhandled exception of the type 'System.MissingMethodException' occurred in System.Windows.Forms.dll"
|
|
|
|
|
Hi All,
Many times I miss to follow good practices for .net development.
I have started collecting a list BEST Practices for .net development or in short a check list on .Net code for optimization to improve my .net development.
For example, Should I use Data List, Data grid and Data Repeater for displaying the data to user where I believe Data List is more efficient way for display data.
Could you please recommend me is any website or any book or a check list which contains Best Practices for .Net.
Thanks & Regards,
Vijay Kulkarni
|
|
|
|
|
|
i want to do real time simulation with WPF.how can i do it?
|
|
|
|
|
That depends entirely on what your simulating and your ability to code it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I concur with Dave.
Obviously a 2 GHz Pentium cannot simulate a 3 GHz Pentium in real-time.
I managed to simulate a 16MHz microcontroller at quarter speed on a 2GHz Pentium tho,
using C# code on .NET 1.1; this means I needed some 500 Pentium cycles to simulate one
target cycle.
The reason for such a factor should be clear: the simulator has to do sequentially
what a microprocessor is capable of doing in parallel (a lot of the chip's hardware
can work in parallel), such as:
- memory translation
- memory protection
- code fetch
- instruction decoding
- operand fetch
- ALU simulation
- flags adjustment
- peripheral processing (e.g. timer countdown, and occasionally interrupt vector
prioritizing and vectoring).
The most costly items in the list seem to be instruction decoding (a switch does not
come cheap) and flag adjustment (setting the zero, negative, carry, ... flags is
not cheap especially without using assembly code).
Since this was one of my first major apps in C# it is conceivable I could revisit
and somewhat improve the performance, but I dont expect that to be very much.
My simulation included ALU, memory and simple peripherals, targetting exact register
and memory behavior, but not exact timing simulation. If you want cycle accurate
simulation be prepared to add some code and get a slower simulation...
Hope this helps.
Luc Pattyn
|
|
|
|
|
i ll control mechanic robot arm.and i ll control it by visual c#.like this:
visual c#---microcontroller------motordrivers---and i ll feedback from motor axesses than i ll send them to visual c# again.
second part of my projects is that i ll do real time simulation.i must model robot arm and it ll get my angle variables from outside and it ll be rotate according to my variables.how can i do like this simulation?what kind of way can be easy for me?
thanks for your kindness
|
|
|
|
|
Hi,
I am not sure this is simulation.
To me simulation is calculating somethings behavior based on a mathematical model, without
having the actual object in existence, or without having it provide information
(such as measured position, angle, velocity, ...)
What you describe sounds more like visualisation: again you create a mathematical model
but now you let it mimic the observed behavior of the real object, by taking
measurements and feeding these in your model.
Anyway I think you can do this in C# (or another hi-level language) like so:
1. create a form with a Panel (for some reason I prefer drawing into a panel);
in the end you will want that to be a double-buffered panel (NET 2.0 knows about
that, under 1.1 you need to derive from Panel and use SetStyles)
2. create some classes that represent parts of the robot arm (upper arm, under arm,
wrist, hand, ...); let them all inherit from a base class "Part".
3. create the model by instantiating the above classes and keep all those instances
in an ArrayList "myModel".
4. give each part class a Paint() method that paints itself in the Panel, so your
entire drawing could consist of foreach(Part p of myModel) p.Paint();
5. introduce a coordinate system (say xyz)
6. assume all angles are known (from measurements)
7. all parts have known lengths and one has a known position; all the others
can be calculated provided you know the direction; some math is involved here.
8. create a periodic timer (I would suggest a Forms.Timer) that iterates over your
model, so it:
- performs all measurements
- recalculates all positions
- redraws the entire model
Real-time aspects:
- the position calculation and drawing seems rather straightforward, they wont
hamper a smooth display
- the most critical part AFAIK would be performing the measurements and getting them
into the PC. You should try to evaluate the time it will take to do all measurements once
before developing all the code, since that may prove it is not possible to get
enough iterations per second, and/or you have to change your micro-to-PC communication
and/or you have to introduce threads (plus the problem that not all measurements
belong to the same point in time).
BTW: you will have noticed I didnt model any motors, the above just knows
positions/angles and visualizes everything.
Hope this sets you on the right track...
Luc Pattyn
|
|
|
|