|
This is what happens when you copy code blindly off the web and don't understand what it does. As someone else said, you need to post code, but you probably also need to work through a C# book so you better understand the code you're working with.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello everyone, I am trying to make csv file as good as excel file. For examle, column should be separated based on ','.
I know how my data comes. it always comes with coma (',')separated. I want to put each coma separated value in each column like excel file.
Thanks in advance.
jashim
|
|
|
|
|
I don't understand any of this. A CSV IS a comma separated file. Excel can open those files. What is your question ? You have columns where ? On your form ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
CSV files is nothing but a file where data are separated by comma.....When you open CSV file in Excel it will auto separate the column by using the deliminator.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
HI Marufuzzaman, I am getting data using deliminator (,), but I don't get those coma separated value in a separat column in excel file. I think the entire text goes to column "A1"
<br />
foreach (string word in strMessage.Split(','))<br />
{<br />
CSVwriter.Write(" " + word);<br />
CSVwriter.Flush();<br />
}
If you know why it does not work please let know
thanks
|
|
|
|
|
You are asking how to turn your CSV data into CSV data?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
ROTFL - yes, now that you say that, I think perhaps you are right.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
My Magic Eight Ball says you want to Split some comma-separated values within a String . Have you searched CP for articles related to this task?
|
|
|
|
|
He does ? Wow.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
The Eight Ball don't lie.
|
|
|
|
|
Don't get me wrong, I would never doubt the power of the 8 ball....
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I remember when calling someone an 8-ball was duragatory
|
|
|
|
|
got it![^]
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Wow - that actually worked, sort of. But it gave an STL sample as first hit. Perhaps you should have put C# in there and used site: to search CP ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I remember there used to be a hidden Eight Ball in MS Access, good times. There was something hidden in most of the MS Office type applications back then; Excel had a little 3D world that you could fly around in!
My current favourite word is: Sammidge!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hi
I have problem returning an XML document in my c# code. The code I am using is as follows:
string xmlString = null;
MemoryStream memoryStream = new MemoryStream();
XmlSerializer xs = new XmlSerializer(typeof(T));
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
xs.Serialize(xmlTextWriter, obj);
memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
xmlString = UTF8ByteArrayToString(memoryStream.ToArray());
return xmlString;
private static string UTF8ByteArrayToString(byte[] characters)
{
UTF8Encoding encoding = new UTF8Encoding();
string constructedString = encoding.GetString(characters);
return (constructedString);
}
The problem I have is when the xml string is returned, the namespace and declaration at the start of the xml string is not in a well formed xml document.
What it is doing is inserting / in front of the equal sign in the name space, thus:
Therefore, I am looking for advice on how to stop this happening.
Can anyone help?
Thanks
|
|
|
|
|
Your example xml header is not showing up. Maybe you need to enclose it in code tags or pre tags.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
namespace VDP{
public class GlobalVar{
Private Const _DIAMONDS As String = "♦"
public string DIAMONDS
{
get { return _DIAMONDS };
}
}
}
namespace VDP{
public partial class frmMain: Form{
Switch (x){
case globalVar.DIAMONDS:
}
error: A Constant Value is expected on this line: case globalVar.Diamonds:
Not sure where I went wrong. All I want to do is compare x to my Const DIMAONDS
|
|
|
|
|
Usually you don't copy VB.NET code into C#.
|
|
|
|
|
Thanks for the reply, however it wasn't very helpful.
My task is to convert a program that I wrote from VB to C#. I am not copying the VB directly in. I am trying to re-write the program in C#. As a complete novice, all I can do is try. Are you saying that all of my code is completely wrong?
|
|
|
|
|
yogi_bear_79 wrote: Private Const _DIAMONDS As String = "♦"
public string DIAMONDS
Try changing the above to
private const char _DIAMONDS = '♦';
public char DIAMONDS
{
...
|
|
|
|
|
Thanks, I made the suggested changes in my GlobalVar class. I now get an error on this line:
private const char _DIAMONDS = '♦';
Cannot implicitily convert type 'string' to 'char'
|
|
|
|
|
yogi_bear_79 wrote: private const char _DIAMONDS = '♦';
Cannot implicitily convert type 'string' to 'char'
This looks OK, are you sure the quote characters are definitely single quotes? If you use double quotes then the compiler thinks it's a string rather than a single character.
|
|
|
|
|
That's not really the "right" error you know, it should say "Syntax error: this is C#, not VB"
Blind suggestion (untested)
namespace VDP
{
public class GlobalVar
{
public const string DIAMONDS = "♦";
}
}
namespace VDP
{
public partial class frmMain : Form
{
switch (x)
{
case globalVar.DIAMONDS:
break;
}
}
}
Hint: the right side of a case should be an actual constant, not a "thing that is logically constant", but syntactically constant.
Good luck
|
|
|
|
|
Thanks, like I said, I am just a novice this is my first project to convert the Poker game I wrote in lesson 1 to C#.
I get the following error after following your suggestions:
Member VDP.GlobalVar.DIAMONDS cannot be accessed with an instance referance; qualify it with a type name instead
|
|
|
|