|
aspdotnetdev wrote: 3) Events must have a certain signature (e.g., a sender and a parameter derived from EventArgs).
Not true. You can create you own events using any parameters you want, standard classes or custom, or even no parameters at all.
I might be thinking of the handler has to have the exact same signature as that specified by the event definition.
|
|
|
|
|
Quite right (just tried it). I must have just been reading about the style Microsoft uses for all their events.
|
|
|
|
|
1) Incorrect, they can use any of the normal access modifiers
3) As you've already discovered below, also incorrect... the can have any signature and even a return type!
|
|
|
|
|
DaveyM69 wrote: Incorrect, they can use any of the normal access modifiers
Dang, I'm off my game today. Thanks for the correction.
DaveyM69 wrote: As you've already discovered below, also incorrect... the can have any signature and even a return type!
Yeah, I think this is what threw me off:
Finally, even though C# allows it, the .NET framework adds a restriction on the signature of delegates that can be used as events. The signature should be foo(object source, EventArgs e), where source is the object that fired the event and e contains any additional information about the event.
|
|
|
|
|
Friends
I, myself and with the help people of codeproject, developed a windows application.
It is running fine BUT while printing recpt. via crystal report some garbaje is getting print(where varibale data exits).
sometime it doesnt print any data(ie. variable data) and sometime it prints garbage and sometimes it print PERFECT.
Donno why?
PLz Help
|
|
|
|
|
Is Print preview OK? Does other application like Word print normaly?
I think you have a bad connection to printer, Check the cable.
|
|
|
|
|
I am developing a Win CE app in c#,
I need to use a ssl certificate and make calls to the secure(https) web service.
please help how i can add the server certificate (".cer" file) before making calls to the web service.
This is what i am trying.
using System.Net;
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallback;
where CertificateValidationCallback will validate an X509 certificate.
But i am not getting ServerCertificateValidationCallback property, as i think its not avilable for device application.
So whats the alternate option to implemennt the same.
Please help!
Thanks in advance,
Fatima
|
|
|
|
|
Hi ppl,
I have a table with two column ID (tinyint) and TEXT (varchar). I am using this table to populate the droplist on my windows form.
when i select items from the droplist I am getting this error "ByteConverter cannot convert from System.Int32." NotSupportedException was unhandled.
I am populating the selected ID of the droplist into the main table.
Pls help.
thanks,
|
|
|
|
|
show us the code that's handling the selection of the droplist item....45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
combobox.datasource = data.tbtest;
combobox.DisplayMember = "Text";
comboBox.ValueMember = "ID";
This code populates the combobox droplist. and the user selects the appropriate value and the selectedvalue ID gets stored into the Form Table on Button click.
Just to add on (on Button Click)
table.TestID = Convert.ToByte(comboBox.Selectedvalue)
I hope this makes sense.
|
|
|
|
|
I'm not clear why you are converting it to a byte, however ...
SelectedValue is of type Object and so you will be calling the Convert.ToByte overload that takes Object , which MUST implement IConvertible . Int32 does not implement this interface.
The solution is to force it to an int first . e.g.
table.TestID = Convert.ToByte((int)comboBox.Selectedvalue)
|
|
|
|
|
|
Thanks, I stand corrected. I checked as far as it is a structure and missed the interface declaration.
|
|
|
|
|
Sorry mate. By CType do u mean Conversion.ChangeType in C#?
Could you provide the same in C# please.
I am converting it to Byte because the column in of type tinyint (8 bit integer = 1 byte)
Thanks,
|
|
|
|
|
Thanks for the answer. When i select an item from the combobox and tab to the next control... its giving me the same exception. Do I have to change any property of the combobox?
Cheers!!
|
|
|
|
|
spankyleo123 wrote: . When i select an item from the combobox and tab to the next control... its giving me the same exception
What excepiton? Where it does happen, and in witch event?
|
|
|
|
|
Its this one ... "ByteConverter cannot convert from System.Int32." NotSupportedException was unhandled.
This happens when i select a combobox item and go to next control on the form.
Many thanks,
|
|
|
|
|
This thread seems to be getting lost. Try stepping through the code in the debugger (put a breakpoint where the exception occurs), and capture all values. Then post those values, the exception, and the code around the exception, so people can see everything that is involved with the problem in one message. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
I've tried at least three free custom controls, and either they make very broad assumptions, or are so poorly designed and documented as to be unusable.
I've tried SuperList, ObjectListView, and one other that I don't recall the name of.
I need the following features (in order of importance, but first three are must-haves):
0) The ability to put one *or more* images in a given cell along with text
1) Sorting on any column
2) Supports grouping
3) Multi-line items
4) Alternate row colors
Can anyone steer me to something usable (and free)?.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
|
Wow, that looks great! I'm gonna go check it out..45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
Hey,
I want to create a .xlsx file based on data from a grid.
My problem: I have values like 01234 (starts with zero) exporting them make 1234 ... so, how can I export it with right format?
I fill the file with:
if (Excelpfad == "")
return false;
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.Workbook newWorkbook = excelApp.Workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
Microsoft.Office.Interop.Excel.Sheets excelSheets = newWorkbook.Worksheets;
string currentSheet = "Tabelle1";
Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)excelSheets.get_Item(currentSheet);
for (int i = 0; i < UsingGrid.Cols; i++)
{
for (int j = 0; j < UsingGrid.Rows; j++)
{
worksheet.Cells[j + 1, i + 1] = Convert.ToString(UsingGrid[j, i]);
}
}
for (int iExcel = 0; iExcel < UsingGrid.Cols; iExcel++)
{
((Microsoft.Office.Interop.Excel.Range)worksheet.Columns[iExcel + 1, t]).ColumnWidth = UsingGrid.get_ColWidth(iExcel) * 0.13171875;
}
if (Excelpfad.Substring(Excelpfad.LastIndexOf(".")) == ".xls")
worksheet.SaveAs(Excelpfad, Microsoft.Office.Interop.Excel.XlFileFormat.xlExcel8, t, t, t, t, t, t, t, t);
else if (Excelpfad.Substring(Excelpfad.LastIndexOf(".")) == ".xlsx")
worksheet.SaveAs(Excelpfad, t, t, t, t, t, t, t, t, t);
and another question: how can I close that file correct?
I have:
newWorkbook.Close(true, n, n);
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);
but the "EXCEL.EXE" process still run
thank you
|
|
|
|
|
Mschauder wrote: for (int j = 0; j < UsingGrid.Rows; j++) { worksheet.Cells[j + 1, i + 1] = Convert.ToString(UsingGrid[j, i]); } }
first question:
something like:
r.NumberFormat = "@";
Note this is language specific(system language and settings).
Best way to do it is record a macro while you set the Format to text and look at the VBA produced and
translate it to C#. This silly article is especially about formatting. And the export is a lot faster than the cell by cell aproach.
|
|
|
|
|
Hi,
I am allowing user to select datetime in datetimepicker in "dd/MM/yyyy" format but when it stores in sqlserver 2005 it store as "mm/DD/yyyy", but i want it store as "dd/MM/yyyy" format in SqlServer 2005, how can i do that OR When i filter records, it should be in "dd/MM/yyyy" format ?
Regards,
XYZ
|
|
|
|
|
The internal format used to store a date time has nothing to do with how it is serialized as a string. Both SQL and C# have techniques for serializing date/times. In particular, you'll want to look into DATEPART and CONVERT for SQL and ToString and String.Format for C#. The C# DateTime also has several methods that allow you to serialize to different common formats.
|
|
|
|