|
try this idea with your code ...
dataset.Tables[0].WriteXml(....);
I know nothing , I know nothing ...
|
|
|
|
|
This does not work either.
Let me give you a sample of my code.
I've added a datasource via the Visual studio wizard, it then created DataSet for me called _Workstation_aXYZDataSet.
What I then did, is create a new instance of this by doing this: _Workstation_aXYZDataSet dsWorkStation = new _Workstation_aXYZDataSet , which I think my problem is since I create a NEW instance. I then try calling the WriteXml() method on dsWorkstation
When I type dsWorkstation. it shows me a drop down list of all the tables, meaning it has tables right? Or maybe not?
Isn't there a way to call WriteXml() direclty from _Workstation_aXYZDataSet which was created for me as a strongly typed dataset?
|
|
|
|
|
I really don't wanna answer you with puzzles , so I will give a clue about how do my projects ...
- Keep in mind , after create a new instance of dataset you must fill it with dataadpter.
- Try to Create Dataset by code : like this :
DataSet ds = new DataSet();
SqlDataAdapter Sqlda = new ("SELECT * FROM table" , SqlConnection);
Sqlda.Fill (ds);
ds.Tables[0].WriteXml(...);
Hope this help ....
I know nothing , I know nothing ...
|
|
|
|
|
I have class like Project, and UseCase AddProject.
Like below. How should I implement the service of event, message: "Project was added corectly", or "Project was not added (Project exist)" and send message to user.
Events in C#, or what?:/
Maby application class should have implement event?
public event myEventHandler ProjectAdded;
What is the best practice?
public MyMessage AddProject(params string[] ProjectData){
Project tempProject = new Project();
tempProject.Id = Guid.NewGuid();
tempProject.Name = ProjectData[0];
tempProject.Number = ProjectData[1];
if (!m_Project.Contains(tempProject))
{
m_Project.Add(tempProject);
return new MyMessage(true,string.Format("Project: {0} ADDED",tempProject.Number));
}
else
{
return new MyMessage(false,string.Format("Project: {0} NOT ADDED (Project exist).", tempProject.Number));
}
}
public struct MyMessage
{
private bool _executed;
private string _message;
public MyMessage(bool executed, string message)
{
_executed = executed;
_message = message;
}
public bool IsExecuted
{
get
{
return _executed;
}
}
public string Message
{
get
{
return _message;
}
}
}
In program....
Console.WriteLine(ap.AddProject("Name" , "0000000001","Description", DateTime.Now.ToString(), DateTime.Now.ToString()).Message);
modified on Saturday, May 30, 2009 7:59 AM
|
|
|
|
|
Well you should use events if you want to handle the message asynchronously.
Your "In program...." example shows you handle it synchronously, so what you did should be fine.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Hi there.........
I am using text reader to read a text file. I have used the following code:
string str = "C:\\MKS.txt";
TextReader textreader = new StreamReader(str);
string inline = "";
while ((inline = textreader.ReadLine()) != null)
{
if (rtEngData.Text == "")
{
rtEngData.Text = inline;
}
else
{
rtEngData.Text = rtEngData.Text + Environment.NewLine + inline;
}
}
Here in my input file (in this code C:\MKS.Txt), a character ë is used.
(Go to the notepad and type ALT+0235, you will get the character.)
Now when I read this file, for this character it reads '�' .
Please tell me if there is any problem with my code block. or suggest me to get proper character.
Thanks....
Vishal.
|
|
|
|
|
Try replacing your TextReader line with this:
TextReader textreader = new StreamReader(str, Encoding.UTF7);
Note the explicit setting of the Encoding argument
|
|
|
|
|
Hi there....
Thanks for you suggestion. It worked.
The character I used ë is present in arial font. Can you please describe me why to use "UTF7".
Arial is a 1 byte font. So, in my opinion it should work without any encoding.
Thanks.......
Vishal.
|
|
|
|
|
Another useful suggestion is you should use a StringBuilder like:
StreamReader textreader = new StreamReader("C:\\MKS.txt", Encoding.UTF7);
string inline;
StringBuilder sb = new StringBuilder();
while ((inline = textreader.ReadLine()) != null)
{
sb.Append(inline);
sb.Append(Environment.NewLine);
}
rtEngData.Text = sb.ToString();
This will be much more performing.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
You are right, however this isn't optimal either. Since you can easily get the file size, you should create the SB with an initial capacity equal to say 1.5 times that (allowing for the NewLines), so it never has to extend itself (which causes all data to be copied).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
why are you reading a stream yourself?
if you can hold all the data in memory, chances are you can afford to do this too:
string[] lines=File.ReadAllLines(str);
rtEngData.Text=string.Join(Environment.NewLine, lines);
and, depending on what line separators are in the file, maybe
rtEngData.Text=File.ReadAllText(str);
is all you need.
FYI: these File methods also accept an Encoding parameter if you need one.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
ë is part of the ANSI code set; code page 1252.
You do not want to use UTF-7; it has nothing to do with ANSI and will do odd translations of characters.
Use System.Text.Encoding.GetEncoding(1252);
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hello,
I've put a TabControl on a Form and added some buttons to add pages and change the Alignment.
When the Tabcontrol is left aligned (vertical tabs) I'd like it to display only one row of tabs with scroll buttons when it overflows. Just like when its alignment is Top.
private void button1_Click(object sender, EventArgs e)
{
tabControl1.TabPages.Add(new TabPage());
}
private void button2_Click(object sender, EventArgs e)
{
if (tabControl1.Alignment == TabAlignment.Top)
{
tabControl1.Alignment = TabAlignment.Left;
}
else
{
tabControl1.Alignment = TabAlignment.Top;
tabControl1.Multiline = false;
}
}
Any help on this would be sincerely appreciated.
|
|
|
|
|
hi
Increase the height of the Tab control
|
|
|
|
|
Hi Satish,
Thank you for your input but alas your solution doesn't work for me. Maybe I should add a few requirements:
1. Users should be able to add tabpages "ad infinitum".
2. Finally the tabcontrol should be hosted in a toolstrip in a toolstripcontainer. (So it will resize with the screen.)
Actually would I'd like to create is a "Tabstrip control" which can be swung around to dock to any side of the screen, just like a Toolstrip inside a toolstripcontainer.
It works fine when it sits on top or bottom of the screen, but when docked on either left or right side of the screen, i can't get the autoscroll buttons to appear, when the tabs overflow.
|
|
|
|
|
|
Hi
If u get the solution please let me know
|
|
|
|
|
Hi Satish,
Once more thank you very much for your persistence and effort. But this doesn't cut it.
If you change the size of the tabcontrol in your solution to 100,100 you'll see two rows (actually columns) of tabs appear, on the left hand side. I would like it to be one column with a "scroll" button.
Now if you change the alignment of the tabcontrol to "Alignment.Top" you'll see only one row of tabs with a scroll "thing" (left and right arrow) (still with the tabcontrol to size 100,100).
I desperately try to get the same effect when the TabControl's Alignment is set to "Left"
Could /should i try a a collection TabPages in a ToolStrip (via ToolStripControlHost)?
I'd be thankful for any advice.
|
|
|
|
|
hi,
how can the pdf file can be downloaded on to desktop in a folder from web application
|
|
|
|
|
tauras81 wrote: how can the pdf file can be downloaded on to desktop in a folder from web application
Perhaps by writing code to do it? See point #2 in this post[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Does the PDF viewer in the web application, not have a save or save as option?
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.”
|
|
|
|
|
Hi all!
I am running one exe, and this is shown in the task manager
I dont wanat to kill that process anymore, so i would like to attach that exe process
with any one of the existing process !
pls some one can.... help me !
thanks .
Regards
Jack
|
|
|
|
|
Your query makes no sense. Also, which part of this question has anything to do with C#? Are you wanting to inject your code into another PE file? Are you wanting to create a thread in the context of a different process? You want to terminate an application? JUST WTF?!
Read the guidelines[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Can u describe it what is your problem.
If you can think then I Can.
|
|
|
|
|
I have created a watchdog in C#, which monitors a particular agent
When the user try to kill the agent from the task manager then the Watchdog starts the agent once again
problem:
How to disable or not allow the user to kill that watchdog ?
so i thought of attaching the watchdog with existing process so that the user can not find out, because watch dog does not run with seperate process name.
Example:
When we install Nokia PCSuite 6.84.10.3, it does not run with sperate process rather runs with explorer.
so can we also attach the watchdog with any one of the existing Process.
OR is there any other way to protect killing the watchdog from task manager!
thanks ...
Regards
.....Jack
|
|
|
|