Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am trying to download datagridview to an excel. Below is the code i am using.

X - Values
C#
string[] arrRootCause = {"Batch Issue","Change Request","CICS Online Entry Error","Data Conversion Issue","Data Requirement Incorrect",
                                     "GS Code Issue","Incorrect in FS","In-house Code Issue","Integration Error","JCL/PARAM/PROC Issue","Load issue",
                                     "Missing in FS","Others","Query","Region Data Incorrect","TBA","Understanding Issue","VisionPLUS Base code Issue"};


Y1 and Y2 values:
C#
int[] TCStatus2 = { 3, 4, 53, 23, 53, 63, 83, 93, 13, 3, 93, 73, 43, 43, 23, 33, 43, 53 };
int[] TCStatus3 = { 53, 42, 5, 23, 23, 93, 13, 33, 63, 36, 13, 11, 63, 13, 93, 73, 13, 73 };


C#
List<StackedBarChartData> sbcData = new List<StackedBarChartData>();

           for (int i = 0; i < arrRootCause.Length; i++)
           {
               StackedBarChartData sb = new StackedBarChartData();
               sb.Y1Values = TCStatus3[i];
               sb.Y2Values = TCStatus2[i];
               sb.XValues = arrRootCause[i];
               sbcData.Add(sb);
           }

dataGridView1.DataSource = sbcData;


After i execute the windows form application I am getting output as below,

XValues Y1Values Y2Values
Batch Issue 53 3
Change Request 42 4
CICS Online Ent... 5 53
Data Conversion... 23 23
Data Requiremen… 23 53
GS Code Issue 93 63
Incorrect in FS 13 83
In-house Code I... 33 93
Integration Err... 63 13
JCL/PARAM/PROC ... 36 3
Load issue 13 93
Missing in FS 11 73
Others 63 43
Query 13 43
Region Data Inc... 93 23
TBA 73 33
Understanding I... 13 43

As you can see above, CICS Online Ent... is coming instead of CICS Online Entry Error. Same is happening with some other strings in arrRootCause.

I tried increasing the width of the column, but of no use.

Can anyone help me in understanding what is the problem.
Posted
Updated 12-Jan-15 20:18pm
v2
Comments
Taucher Christoph 13-Jan-15 5:15am    
Could it be that the Class "StackedBarChartData.XValues" is defined only with a Character(string) Lenght of 15, it seems so
PrashanthJagannath 14-Jan-15 0:21am    
Hi Christoph, No it is not defined to take a character length of 15. Actually it is taking 18 characters as default. Do you know how to remove the default length of 18?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900