|
I am creating a List of structure like:
List<MyNS.Graph.XY_AXIS> Axis = new List<MyNS.Graph.XY_AXIS>(); but I need to create array of such object dynamically.
I am new to C# so got stuck.Please guide .
|
|
|
|
|
How dynamic do you want it?
List<MyNS.Graph.XY_AXIS> Axis = new List<MyNS.Graph.XY_AXIS>();
Axis.Add(X,Y);
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks but I need array of Axis. I need to create an array of List say 10, each List element will be object of class. How to do that?
|
|
|
|
|
Use the ToArray() method of the list after you added all the items.
|
|
|
|
|
john5632 wrote: I need to create array of such object
You question is ambiguous. An array of the list or an array out of the list?
If you want to create an array of the list, you can probably use a List of List like this:
List<List<MyNS.Graph.XY_AXIS>> Axis = new List<List<MyNS.Graph.XY_AXIS>>();
If you wish to create an array out of the list, then use:
MyNS.Graph.XY_AXIS[] axisArray = Axis.ToArray();
|
|
|
|
|
Hello CP,
I've run into a problem while working on an interface for the result of raw SQL.
The user inputs the raw SQL code and the form renders a result, it's an educational piece of software so nothing too fancy.
Now, the problem I have is that after putting the result into a DataTable, it crashes when I pass it as a DataSource for the DataGridView.
The database I'm querying is an MSAccess (2003, mdb) database.
Oddly enough, it doesn't misbehave (crash) when I'm using an SQLite database.
I would like some help since the stacktrace isn't making sense to me.
Quote: A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll
System.Transactions Critical: 0 : <tracerecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" severity="Critical"><traceidentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled<description>Unhandled exception<appdomain>SimpelQL.Net.vshost.exe<exception><exceptiontype>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089<message>Parameter is not valid.<stacktrace> at System.Drawing.Font.GetHeight(Graphics graphics)
at System.Drawing.Font.GetHeight()
at System.Drawing.Font.get_Height()
at System.Windows.Forms.DataGridViewRow..ctor()
at System.Windows.Forms.DataGridView.get_RowTemplateClone()
at System.Windows.Forms.DataGridView.RefreshRows(Boolean scrollIntoView)
at System.Windows.Forms.DataGridView.RefreshColumnsAndRows()
at System.Windows.Forms.DataGridView.OnDataSourceChanged(EventArgs e)
at System.Windows.Forms.DataGridView.set_DataSource(Object value)
at Proj.Net.MainForm.evt_Exec(Object sender, EventArgs e) in L:\Dev\Proj.Net\MainForm.cs:line 139
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
|
|
|
|
|
Do you have a custom paint-handler? Any other event that is triggered on a refresh, using Fonts?
Cover the lot with breakpoints, and show us some code
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I went a whole lot simpler and it's still throwing exceptions.
private void frm_Shown(object sender, EventArgs e)
{
DataTable t = new DataTable();
t.Columns.Add("a");
t.Columns.Add("b");
t.Rows.Add("a","b");
System.Diagnostics.Debug.Assert(t.IsInitialized == true);
dataGridView1.DataSource = t;
}
I have no idea why this is bugging.
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
|
|
|
|
|
I do; this is not all code. You've prolly got drawing-events assigned, check out what happens if you put them into comments. Or paste enough code to reproduce the problem on the board
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
In a C# 2008 console application, I need to send doucments to a web service. This is marked with the following xml: subDocuments attachmentId="xx3">.
I need to send word documents, excel spreadsheets, and PDF files back to the web serivce. Can you tell me how I would accomplish this goal using code?
The xml that I need to generate along with the documents is listed below:
<ns2:RetsubPack serviceSuccessful="true" returnCode="0" xmlns:ns2="http://test1/test">
<statusDescription>Package Details retrieved Successfully</statusDescription>
<PackageDetails>
<Type>type2</Type>
<Category>dog</Category>
<ContName>Co 1</ContgName>
<TotalTrans>0</TotalTrans>
</PackageDetails>
<NumberOfDocuments>3</NumberOfDocuments>
<subDocuments attachmentId="xx1">
<DocumentMetadata>
<DocumentTypeCode>Spreadsheet1</DocumentTypeCode>
<PackageId>pkg1</PackageId>
</DocumentMetadata>
</subDocuments>
<subDocuments attachmentId="xx2">
<DocumentMetadata>
<DocumentTypeCode>Spreadsheet2</DocumentTypeCode>
<PackageId>pkg1</PackageId>
</DocumentMetadata>
</subDocuments>
<subDocuments attachmentId="xx3">
|
|
|
|
|
Perhaps if you could be much more specific with your question. Exactly what is it that you're having trouble with?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I do not know how or where to get started at.
|
|
|
|
|
Start by investigating webservices. Create a basic one from a tutorial and work from there.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi, I saw many open source programming projects but many of them are hard for the first time. Do you know any resources for my need?
|
|
|
|
|
atoi_powered wrote: many of them are hard for the first time
You should then be focusing on smaller projects that fit your skill level. Why not work on your own small projects that you feel confident in doing, and as you progress, add some advanced ideas.
There are plenty of articles around here that you can start to get some ideas. What topics in programming are you interested in?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Sorry I don't understand the programming topics. You mean like Web-based apps or so on?
|
|
|
|
|
Whatever interests you...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Just simple programs for PC like one written for supermarkets (very simplest one just obeying the basic procedures).
|
|
|
|
|
I do not know what your level of expertise is, and a simple POS (point of sales) system at its most basic level might be okay. Just start thinking about the basic procedures and experiment around and learn. Just as a pointer, I will not give code out how to do this type of system, as it would not help you in your learning
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
.NET Book Zero[^] is a good introduction to both .NET and C#, with some easy samples to help you learn from.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
It's not what I was looking for but thanks. It's good and also, necessary!
|
|
|
|
|
Given your question I would say it's exactly what you are looking for.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I am a student of computer science given a topic to implement a lossless or lossy coding. this topic is entirely new to me. Can anybody tell me how to start and go about it?
Mubi
|
|
|
|
|
I would start by reading up on the various different types.
|
|
|
|
|