|
Those arguments aren't very convincing, though. I think it is mostly a subjective stylistic decision aiming toward simplicity. Whether it is really better is probably more a matter of your personal programming style.
On the plus side, it is not too hard to work around:
string Transmogrify( string text, int cycles, bool superamalgamate )
{
}
string Transmogrify( string text, int cycles )
{
return Transmogrify( text, cycles, false );
}
string Transmogrify( string text )
{
return Transmogrify( text, 1 );
}
Unfortunately, this probably results in a little more maintenance trouble than it would with default parameters.
Matt Gerrans
|
|
|
|
|
i am trying to use a word template(.dot file) and a text file in a windows form using C#.i am aware how to extract data from the text file and open the word template.but what i am unable to do is to use the data from the text file in the word template's form fields.
can u tell me how i can replace the form fields with the value or data that i'm retrieving from the text file.
the template when open looks something like this....
Receipt Number : «ReceiptNo»
Card Number : «CardNo»
Member Name : «MemberName»
now,i've got to replace the fields «ReceiptNo»,«CardNo»
and «MemberName»...
i hope u've got an idea of what reply i'm expecting....
thank u...
|
|
|
|
|
I want to have the RGB bytes of a panel from a form to output what on the panel through the serial port
I can do that if the picture on my harddisk ,but the pic on the panel.
what can I do?
and why when I use these steps to get a screen shot it doesn't work, and give me an error message in debugging?
Surface backbuffer = device2.GetBackBuffer(0, 0, BackBufferType.Mono);
SurfaceLoader.Save("Screenshot.bmp", ImageFileFormat.Bmp, backbuffer);
backbuffer.Dispose();
thx
|
|
|
|
|
|
bitmap.GetPixel() method can get the Color value of the pixel at the specified coordinates, and from there, you can get the RGB bytes from the color structure.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
I think GetPixel() is slow
i need it faster.
thx
|
|
|
|
|
|
|
Thanks in advance for any help. I am 1 month new to visual c# so please excuse the probly obvious question. I am working on Visual Studios 2003 ver 7.1. I have created a windows form attached to a sql server db.Every time I "apply" changes to a record on my form, the selected index of my list box (which is binded to my dataset) jumps around and then goes back to the record I had selected before the update. The problem is that every time it moves my selected_indexed_changed event is fired and this is causeing me a great deal of trouble. Does anyone have any suggestions?
Thanks again for the advice.
Trent Jackson
|
|
|
|
|
I created an C++ MFC Dll project and am trying to call a function in the dll from a C# Class Library project using DllImport.
I seem to remember that when using DllImport you have to also add a reference to the dll in the project you're using it in. When I go to add a refernce to my MFC.dll in the C# Class Library references I get this error:
"A reference to '[path to my dll]mfc.dll' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
I can clearly see that the dll I'm trying to reference is in fact a .dll so I'm wondering - is the problem that it is *not* a valid assembly or COM component? How would you tell if it is or is not? If anyone has any ideas about what may be causing the error, how to fix it i.e. how to add a reference to that dll, or why what I'm trying to do won't work it would be much appreciated.
|
|
|
|
|
Assuming your MFC dll is a straight Win32 dll and not a COM dll then you don't need to add a reference to the dll.
You can only reference COM dlls and .NET assemblies.
Have a read of this MSDN tutorial[^] for better explanation.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
You do not add a reference to a legacy dll when you want to use functions from this dll via DllImport.
Simple as that.
Adding references helps VS at compile time to find the neccessary types.
DllImport-calls are only executed at run-time, so there's no need for references. Your program has to be able to load the DLL you've given in your DllImport statement, so it has to be somewhere in the search path or in the same directory as your application.
mav
|
|
|
|
|
johniboy wrote:
I seem to remember that when using DllImport you have to also add a reference to the dll in the project you're using it in.
No you don't...
You only need to add the reference if your NOT going to use DLLImport. Adding the reference allows you to use early binding so you can see the functions and enums and what-not as design time. It also allows you to use COM components and other .NET assemblies.
There are various types of .DLL's. Library .DLL's, like most of the Win32 API, you don't set a reference too. You just use DLLImport to get at the functions.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am using enum to specify some options and
store the options by integer in database.
But when I unserialize the enum options
from database, I need to mapping the integer value
to the corresponding enum option by switch cases structure.
Are there any better method for mapping the integer
against the enum choice ?
Thanks
|
|
|
|
|
you can do a simple cast:
MyEnum myEnum = (MyEnum)myInteger;
Greets
Roland
Wenn der Computer wirklich alles kann, dann kann er mich mal kreuzweise.
(Manfred Schmidt)
Follow your Euro notes in their tracks
|
|
|
|
|
I noticed that C# provides a serialization, and i'd like to know, if i have a base abstract class, and a load of derived classes (like shapes - circle, rectangle,point), i operate with them in array or a list - i don't know what to use, if C# has an analog to vector in c++ (stl)... So how to save them all with serialization???
|
|
|
|
|
You don't need to do anything, the serialization framework will take care of serializing and deserializing heteregoneous objects.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
But where to find such examples???
Because i can't really understand the mechanism...
I remember in C++ i had to save the type of class before, to get it when i load the object...
But how does it know what object to create in C#?
|
|
|
|
|
Microsoft Excel cannot access the file 'C:\inetpub\wwwroot\AuditSystem\ExcelGen'. There are several possible reasons: • The file name or path name does not exist. • The file you're trying to open is being used by another program. Close the document in the other program, and try again. • The name of the workbook you're trying to save is the same as the name of another document that is read-only. Try saving the workbook with a different name.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Microsoft Excel cannot access the file 'C:\inetpub\wwwroot\AuditSystem\ExcelGen'. There are several possible reasons: • The file name or path name does not exist. • The file you're trying to open is being used by another program. Close the document in the other program, and try again. • The name of the workbook you're trying to save is the same as the name of another document that is read-only. Try saving the workbook with a different name.
hiiiiii
|
|
|
|
|
Im trying to add a refferance to a dll wrriten in visual studio 6 and im getting an error from Microsoft Development Environment saying:"This is not a valid assembly or com component.
|
|
|
|
|
Hi all,
Please Suggest me How to Generate a Excel Sheet in an WEB application with C# as backend with data fetching from Database.
Thanks
Deepak
hiiiiii
|
|
|
|
|
Creating a Excel sheet from C# is easy.
One way to do this is:
Get your database from your datasource.
Turn your data into an XML document
And then with a XSLT file
Display this document as an Excel file.
with XSLT you can include excel functions so calculation can be aready done when it loads.
If you generate an excel spread sheet and then save it as a xml sheet you'll see what your XSLT file should sort of look like
keep smilling.....b'coz smile is the shortest distance between people....
|
|
|
|
|
Hi all
I have a windows application that connects to a webservice. While the app is busy connecting to the webservice the network might be down, so the app kinda hangs while trying to connect to the webservice and I would like to be able to close the app but I'm unable cause the window doesn't respond to the mouse clicks.
If there's any way to close the app gracefully, it would be nice.
Thanks
|
|
|
|
|
You'd need to use threads or asynchronous web service calls then. I'd prefer the latter. The code will look like
public void CallWebService_ButtonClick(...)
{
new MethodInvoker(CallWebService).BeginInvoke(callback, ...);
}
private void CallWebService()
{
}
Just make sure that the UI updates you do from within CallWebService or from within the callback use Control.Invoke or Control.BeginInvoke[^].
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|