|
In your Program.cs (or whatever your startup is), you have to enable visual styles. Something like this:
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks,
that did the job.
|
|
|
|
|
Hey All,
My problem is that sending XML from a web service to client works fine. Using the exact same steps to send that XML back causes a crash!
The web service returns the xml string
<br />
DataSet dsReturn;<br />
...<br />
returnWriter = new StringWriter();<br />
dsReturn.WriteXml(returnWriter, XmlWriteMode.WriteSchema);<br />
return returnWriter.ToString();<br />
The client reads the xml string
<br />
DataSet Budget;<br />
...<br />
srWebService = new StringReader(m_wsBudget.Select("SelectWorksheetbyYearMediaCategory", sYear + "," + sMedia + "," + sCategory));<br />
xmltrWebService = new XmlTextReader(srWebService);<br />
xmlrsService = new XmlReaderSettings();<br />
xmlrWebService = XmlReader.Create(xmltrWebService, xmlrsService);<br />
Budget.ReadXml(xmlrWebService);<br />
This interaction works fine all the time. Using the exact same steps to send that XML back to the web service crashes. For the sake of testing, both Web Service and Client are on the same computer (my development machine).
The exception is:
System.Xml.XmlException: Unexpected end of file has occurred. The following elements are not closed: Comment, HeaderModify, NewDataSet. Line 525, position 31.
This follows immediately after a '#' character in the Comment field of a datatable.
Any advice as to why it works coming from the web service but not sending to it (the Comment field never changed)? Is there another way to easily wrap up the XML from a dataset properly? I would assume .WriteXML() would take care of formatting special characters automatically
Thanks,
Pualee
|
|
|
|
|
|
You can copy and paste from Visual Studio into a RichText control and the formatting is preserved, if you copy & paste into Word you can then save as HTML.
|
|
|
|
|
i have no idea what to name this to. but anyway, i hope i can get some help
i have a while loop which shall go through a few textboxes
the textboxes are named textBox1, textBox2
my code is following
int count = 0;
while(blah) {
count++;
textBox???.Text = "blah";
}
I want to dynamically set the different textboxes with different values, the while loop should through textbox1, textbox2 and so on.
how do i make that?
i hope i explained myself good enough
|
|
|
|
|
Why You are using this while loop.......
You can add all the textboxes to a panel or groupbox then you can use the foreach method like
foreach(TextBox txtbox in panelTextBoxes.Controls)
{
txtbox.Text = " ";
}
My small attempt...
|
|
|
|
|
Place each of your textboxes in an Array and set them that way.
TextBox [] tbArray = new TextBox[] { this.textBox1, this.textBox2 };<br />
int count = 0;<br />
while(blah)<br />
{<br />
tbArray[count].Text = "Blah";<br />
count++;<br />
}
|
|
|
|
|
thanks for your answer, it works
|
|
|
|
|
Here is my code to move list items down the list.
<br />
if (!(listView1.SelectedIndices.Count == 0))<br />
if (!(listView1.SelectedIndices.Count > 1))<br />
{<br />
if (listView1.SelectedItems[listView1.SelectedIndices.Count - 1].Index != listView1.Items[listView1.Items.Count - 1].Index)<br />
{<br />
int current = listView1.SelectedItems[0].Index;<br />
ListViewItem lvi = new ListViewItem();<br />
lvi = (ListViewItem)listView1.Items[current];<br />
listView1.Items[current] = (ListViewItem)listView1.Items[current + 1].Clone();<br />
listView1.Items[current + 1] = lvi;<br />
listView1.Items[current + 1].Selected = true;<br />
}<br />
}<br />
If there are more then 4 items in the list it will move down the list no problem but "listView1.Items[current + 1].Selected = true;" will not work, it will select the wrong item after (appears to be listview1.Items[current + 3] thats being selected.
What is causing this and how do i fix it?
|
|
|
|
|
Hi,
Can anybody give an example of Virtual functions in .Net? Eventhough I searched in google, I didn't get any site that explains virtual functions in simple terms. Will be great if you could provide an example or provide an url that explains with example.
Thanks in advance.
Meeram395
|
|
|
|
|
HI consider this situation
using System;
using System.Collections.Generic;
using System.Text;
namespace @virtual
{
class Base
{
public void Display()
{
Console.WriteLine("I am from base");
}
}
class Derived : Base
{
public void Display()
{
Console.WriteLine("I am from derived");
}
}
class Program
{
static void Main(string[] args)
{
Base b = new Derived();
b.Display();
Console.Read();
}
}
}
The result will be I am from Base
If you want to dispaly the derived class method you can use virtual methods
using System;
using System.Collections.Generic;
using System.Text;
namespace @virtual
{
class Base
{
public virtual void Display()
{
Console.WriteLine("I am from base");
}
}
class Derived : Base
{
public override void Display()
{
Console.WriteLine("I am from derived");
}
}
class Program
{
static void Main(string[] args)
{
Base b = new Derived();
b.Display();
Console.Read();
}
}
}
this will give I am from Derived
Its like abstract methods, Try to learn design patterns,in which virtual methods are used
My small attempt...
|
|
|
|
|
// ClassA
class A
{
public void M()
{
Console.WriteLine("A.M() being called");
}
public virtual void N()
{
Console.WriteLine("A.N() being called");
}
}
// Class B
class B : A
{
public new void M()
{
Console.WriteLine("B.M() being called");
}
public override void N()
{
Console.WriteLine("B.N() being called");
}
}
say
A a = new B();
a.M();
a.N();
The results would be
A.M() being called
B.N() being called
|
|
|
|
|
Thank you very much for your efforts. it is very clear and simple
Meeram395
|
|
|
|
|
The two answers above give the code, but lack an explanation.
Virtual (and abstract methods) allow you to defer functionality to a derived class. So basically it allows you to write your base class and assume that anyone who ingherits from it can change the behaviour in some way.
|
|
|
|
|
Hi. I would like to create a TreeView with a rootNode( tree.Nodes.Add("root"); ), and then put there some nodes.
|
|
|
|
|
tree.ShowPlusMinus = false;
Return to innocence
|
|
|
|
|
No it's not that i want, but thanks! I want to remove "plus" only from rootNode, but childNodes of rootNode, which have "children"
must have "plus".
|
|
|
|
|
treeview.ShowRootLines = false;
|
|
|
|
|
|
Hi
We are developing Mail tool,
One of the part of this mail tool is to identify the history of mails for one particular email Id
Actually we use webdav search method, to fetch the unread mails from
exchange server and update the status as read, the fetched mails are
inserted into sqlserver table.
Our Problem is.
How to identify the thread mails,
How to differentiate the thread mails to normal mails
How to group by the thread mails
How to identify the first mail in the thread.
Regards,
Arunkumar S

|
|
|
|
|
Hi all,
I'm fairly new at C# and application development in general (I was trained as an embedded systems engineer...). Recently I've had to use C# in the development of a prototype .NET user interface. The old, unmanaged C++ version of the interface made use of a controls library which had specialised int/double text boxes which I emulated by manipulating the Textbox's KeyPress event. Because I find myself using this control in so many dialogues, I've been trying to look for a way to creating a class which inherits from the Forms.Textbox class which I can add onto the Designer from the Toolbox (I should add at this stage that I am using MS Visual Studio 2005).
Any help will be greatly appreciated
cheers!
|
|
|
|
|
You should have no problem with this - its quite straight forward.
All you need to do is create a class and derive it from the TextBox. Then you can override the OnKeyPress/OnKeyDown event(s) as necessary and do whatever work you would usually do against each instance.
Here's my simple example to get you started... it just MessageBox's every character you type.
public class AnnoyingTextBox : TextBox<br />
{<br />
<br />
protected override void OnKeyPress(KeyPressEventArgs e)<br />
{<br />
MessageBox.Show(e.KeyChar.ToString());<br />
base.OnKeyPress(e);<br />
}<br />
}
|
|
|
|
|
Thanks for that...
I'll get cracking straight away on creating the class derived from Textbox, but when I am done how do I add this to the list of controls (the 'Toolbox' in Visual Studio 2005) where one can drag and drop controls onto the WYSIWYG designer? It's just that it's much easier to be able to do this when designing a dialogue rather than to manually type in the numbers and *hope* you get it in the right place...
cheers!
|
|
|
|
|
I found a pretty good article describing what has to be done to extend MS Visual Studio's toolbox: http://symbian.sys-con.com/read/113332.htm
cheers!
|
|
|
|