|
string myPathString = "C:\CCCRM\CCCRM\bin\release\cccrmNeeded.dll";
string fileName = System.IO.Path.GetFileName(myPathString);
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
instead for using the split function you can directly use the Path class of IO
sample code is
System.IO.Path.GetFileNameWithoutExtension (@"C:\CCCRM\CCCRM\bin\release\cccrmNeeded.dll");
and this will return the cccrmNeeded.
|
|
|
|
|
I need to Disable the button "One Page", "Two Page" shown at the top of the PrintPreview Control in the PrintPreviewDialog.Please help me
|
|
|
|
|
hi guys, how will i convert byte array to a file, then open it.
i searched the internet, but they usually create the file first then save it to their local disk, before opening... i just want to open the file(from byte array) from virtual memory.. is it possible?
i need your help badly..
thanks guys..
|
|
|
|
|
File.WriteAllBytes creates a file. Is that what you mean ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
-spy- wrote: need your help badly..
But not badly enough to answer someone who is trying to help you ? Well, great.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
If it's not on disk it's not a file.
Once written to disk you can use Process.Start to "open" it with its associated application. That's what I do.
|
|
|
|
|
Hi All,
This is my first post in this forum that is full of excellent information I'm so glad I found it.
I have a c# program I'm working on it opens an excell file and displayes the results in a DataGrid at the moment I have it selecting the cell with the code below.
//Set excel sheet range
exr.SheetRange = "A1:C5";
What I'm trying to make it do is select the data from cells M3, M4, E5, G5, H5, R5 then go to cell G7 and read till the last empty cell to the right of G7 then read down from G7 to the last empty cell.
Any one know how to do this?
|
|
|
|
|
Hello
Not much to say but the idea is: your problem can be solved with 2 loops (on rows and columns)
try it and reply if not succeeded.
Hope u be happy.
Syed Shahid Hussain
|
|
|
|
|
|
I'm overriding OnKeyDown in a class derived from TextBox .
The new TextBox has several functions, one of which is to only allow a valid decimal (unsigned) value to 2 decimal places. All is well and decimal places are added if necessary - unless the MaxLength is exceeded when the formatting is done in OnValidating / OnLostFocus .
I figured the easiest way would be:
If the key pressed is a number then build the final string in memory, check the length of that against MaxLength and supress the key press if it would exceed MaxLength .
The problem is getting a char or string value from any of the KeyEventArgs properties if the number pad is used. Casting or converting to char returns a, b, c ...
Any ideas?
Edit:
Temporary solution
char digit;
if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)
digit = Convert.ToChar(e.KeyCode - 48);
else
digit = Convert.ToChar(e.KeyCode);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
modified on Tuesday, July 29, 2008 7:18 PM
|
|
|
|
|
A) Have you considered using a NumericUpDown rather than a TextBox?
B) Have you considered using KeyPress rather than KeyDown?
private void textBox1_KeyPress ( object sender , System.Windows.Forms.KeyPressEventArgs e )
{
char digit = e.KeyChar ;
}
|
|
|
|
|
The NumericUpDown is not an option.
I considered KeyPress but it's not raised by non character keys which could potentially screw up other functions
Thanks anyway.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
DaveyM69 wrote: The NumericUpDown is not an option.
Like heck it isn't. "Use the right tool for the right job." -- Scotty et al
Aaaanyway...
Perhaps a Dictionary<Keys,char> will do the trick.
But do you really need to know what character was pressed?
And I expect you know about .Handled and .SuppressKeyPress
|
|
|
|
|
Hi,
I have a base class called "UserInterfaceBase" and I'd like the user's programmer can create and plug their own interface.
Is there anyway to do it? Of course the project won't have a reference to the user "homemade" interface, so I think that's the problem I'm having.
Type tUI = Type.GetType(loader.InterfacePDV.InterfaceClass, false, true);
if (tUI == null)
tUI = Type.GetType("JRFW.Appl.CM10.CPDV.UI." +
loader.InterfacePDV.InterfaceClass, false, true);
if (tUI == null)
throw new TypeLoadException(loader.InterfacePDV.InterfaceClass);
PDVUI = (IPDV)Activator.CreateInstance(tUI);
It always throw the TypeLoadException exception.
Thanks,
Dirso
|
|
|
|
|
Sounds like you're trying to do plug-ins. Have you looked at System.AddIn in the latest .NET framework?
Life, family, faith: Give me a visit.
From my latest post: "We are Christian, resistance is futile. Your Jewish traits will be assimilated into the Church collective."
Judah Himango
|
|
|
|
|
Hi,
Thank you so much!!! It looks like nice and easy to use, but since I making a cross plataform software I have to be sure using namespaces implemented in mono framework too.
I just made a test and even if I add the references to the application project, it still throws the exception. I'm now using the type's FullName, and still no luck. Do I need to do anything else?
Thanks,
Dirso.
Updated Code:
Type tUI = Type.GetType(loader.InterfacePDV.InterfaceClass, false, true);
if (tUI == null)
throw new TypeLoadException(loader.InterfacePDV.InterfaceClass);
|
|
|
|
|
Then have you seen Mono.AddIns[^]?
If you're still set on doing it your own way, you'll need to start by calling Assembly.Load on the assembly built by the 3rd party.
|
|
|
|
|
|
Isn't there a list of languages somewhere in .net?? I know I have seen i somewhere but searches yield too many non related results. I just need to have a text box that will list a bunch of languages to store the language that the person filling the form speaks.
|
|
|
|
|
Make a list with the languages you already have, and let the users add other languages to your list if not displayed there.
|
|
|
|
|
I don't believe so. There's one in windows somewhere, it's the list of locales that you can choose. Not sure if you can access it in code tho.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
This will list all the cultures available if that's what you're after?
(Add using System.Globalization; to the top of the class)
CultureInfo[] supportedCultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
for (int i = 0; i < supportedCultures.Length; i++)
Console.WriteLine(supportedCultures[i].DisplayName);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hello
VS 2008
The 2 users that have tried to run the application get this error.
"CATWinApp has encountered a problem and needs to close"
"An unhandled exception ('System.Runtime.InteropServices.COMException') occurred in CATWinApp.exe [2220]. Just-in-debugging this exception failed with the following error: No installed debugger has just-in-time dubugging enabled. In visual studio, just-in-debugging can be enabled from Tool/Options/Debugging/Just-in-time."
The users don't have any visual studio. Only the 2.0, 3.0, and 3.5 framework. Which is needed to run the application. They are only users so they don't have any development tools.
In my application I have a ActiveX control (COM), called "VaxSIPUserAgentOCX.ocx" I have registered this on my developer box using this: "regsvr32 VaxSIPUserAgentOCX.ocx".
The application run ok on my computer but no one elses.
In my references when I select them in the properties name in my application I have the following: AxInterop.VAXSIPUSERAGENTOCX and Interop.VAXSIPUSERAGENTOCXLib. In the properties I have local copy set to true.
I think the problem could be that is not registered on the users' computer. However, I am not sure how to register them. I have tried "regsvr32 VAXSIPUSERAGENTOCXLib" But comes up with "Entry point cannot be found".
Then I go to publish I click on Application Files and select Include (Auto) Requried for both AxInterop.VAXSIPUSERAGENTOCX and Interop.VAXSIPUSERAGENTOCXLib.
Could this ActiveX be causing the problem? And if what is the best method to solve this problem?
Many thanks for any advice,
Steve
|
|
|
|
|
I believe that the user's machines also need to have the COM OCX registered on their machines. From your message, it sounds like you have the Interops on their machines (which can not be registered), but it is not clear if the OCX is on their machines. If not, put the OCX on their machines and register the OCX and, hopefully, that will resolve the issue.
|
|
|
|