|
If it's straight data, yeah, that works. If he's formatting it, not so much.
|
|
|
|
|
It doesn't matter how much you format it, the bean counters will always change it so that it looks totally different, because they are all "Excel experts"!
In the sample code in the question it is just straight data - no formatting or formulae.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
|
Yeah, by careful who you reply to. I got a notification that you replied but the OP didn't.
I know about ClosedXML.
|
|
|
|
|
|
You may want to try EPPlus-Create advanced Excel spreadsheets on the server - Home[^]
Works quite well.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Hi all
I am beginner with C# programming. I have a problem with Teleric split button. I want to have the index number (or value) of menu item in split button. please help me.thanks.
|
|
|
|
|
Member 12938797 wrote: I am beginner with C# programming
Then you get familiar with reading the documentation that came with the control suite. If you still can't figure it out, ask the support people. You paid for the controls you also pay for support and they are the most familiar with their library than random strangers on the internet. You can contact them here Support and Learning | Telerik[^]
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
the the "defaultitem" property is used for this case. I need a code to learn how to use this property.
|
|
|
|
|
Member 12938797 wrote: I need a code to learn how to use this property
Then do what I already told you to do and read the documentation. If you still can't figure it out, go to the Telerik website and ask them your question. We aren't a "write code for me" website.
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
Agreed, Telerik documentation has with detailed examples. They also have a demo app of all other their tools for the type of project that you are developing for - ie: Wpf, Winforms, Asp, Mvc, etc... This app has a tab where you can view the source for the demo.
|
|
|
|
|
I am using Digital Persona One Touch SDK to create finger print based authenticating application in C#. There is a sample application (and code) given with it, when I installed it I could run that. It creates Template and Verifies correctly. But actually I want to save the finger print template data into MySql database and then retrieve that from database and compare while verifying.
So is there any way or technique to store the template data in mysql database and then retrieve it.
Kindly reply whoever knows any thing I am in a great need of it.
Thanks and Best regards
|
|
|
|
|
The Blob conquers all.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Also, do not repost questions on multiple forums. You were provided an answer on your previous post, Saving fingerprint template to SQL database. You should use that answer and build on top of that.
If you do not know how to do that, read some online tutorials first.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hello,
I'm creating a custom exception that I want to display addition information. I have this so far, and it works, but it feels wrong. I was wonder if there was a better way.
public class AccessIOPortException : Exception
{
public AccessIOPortException(string message, int port)
: base("Error while accessing IO port " + port.ToString() + Environment.NewLine + message) { }
}
and then to call it
<pre lang="c#">
catch (Exception X)
{
Utilities.LogEvent(new AccessIOPortException(X.Message, port));
}
Any input would be greatly appreciated. Thanks!
|
|
|
|
|
If you are using C#6, try this instead:
public class AccessIOPortException : Exception
{
public AccessIOPortException(string message, int port) : base($"Error accessing port {port}{Environment.NewLine}{message}")
{
Port = port;
}
public int Port { get; }
}
This space for rent
|
|
|
|
|
What's "wrong" with this is that you are not "throwing" your new exception; you're simply creating an instance of the exception and passing it around.
If you throw your new exception, it will become the "inner" exception of any later exception handling, if any; otherwise, it is "the" exception.
Exception.InnerException Property (System)
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
For any real exception, you'll need to make it serializable.
You should also have a constructor which accepts the inner exception, if there is one.
[Serializable]
public class AccessIOPortException : Exception
{
public AccessIOPortException(string message, int port, Exception innerException) : base(FormatMessage(message, port), innerException)
{
Port = port;
}
public AccessIOPortException(string message, int port) : base(FormatMessage(message, port))
{
Port = port;
}
protected AccessIOPortException(SerializationInfo info, StreamingContext context) : base(info, context)
{
Port = info.GetInt32(nameof(Port));
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue(nameof(Port), Port);
}
private static string FormatMessage(string message, int port)
{
return $"Error while accessing IO port {port}\n{message}";
}
public int Port { get; }
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I would find an article explaining this code very valuable, and I think many others would also benefit.
thanks, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
Hi I am new to c# and learning a lot lately. My question relates to classes. Say I create a class then fill it with my parameters and a constructor, do I need a method for functionality in the class or do classes not always need functionality. Just a general question.
|
|
|
|
|
Are you asking this more from a language-lawyer point of view (having no methods is of course allowed by the language) or more from a design point of view, eg how useful is a class with no methods?
|
|
|
|
|
Properties are kinda like methods. A class could be nothing more than a data bag. He could use a struct instead, but why bother?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Depends on what you are storing in the struct, and what you are doing with it.
Using struct and class - what's that all about?[^] explains it, I think (even if it is blowing my own trumpet).
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
The only hard and fast rules as far as what to use are enforced by the compiler. Everything else are just guidelines.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
A class does not even need an (explicit) constructor. Any data members of such a class will be initialized with the default value for their type. If you make all the data members 'public', you may access them by name.
However, writing classes this way is IMO an abuse of the language. Just because it can be done does not mean that it should be done.
As usual, every rule has its exceptions; there are some cases when this is just what you need.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|