|
I checked your code. It works just fine. Can you debug your code and tell us exactly in which line you get the error.
Live Life King Size
Alomgir Miah
|
|
|
|
|
My debugger doesn't work, it has a problem doing remote debugging, how do I set that up?
|
|
|
|
|
Hi all,
I need to make a pie chart in Excel but cant find the correct constant!
Excel.Constants.xl3DBar is available but not xl3DPie!
When I run the macro tool on Excel it uses the constant xl3DPie but when I try to use it in my C# code I get an error.
Any ideas?
schoudhr@hotmail.com
|
|
|
|
|
I brought this up a few days ago. However, I have yet to find a solution that fits my needs. I need a textbox to display : "00:00:00" for hours minutes and seconds. I need this format to be "locked." Therefore, not allowing the user to change the format. Each colon would be static. Any help would be much appreciated. Thanks
D
|
|
|
|
|
You need to use masked textbox search for one to get your request or use the following class as start to develop your one.this class will masked by 00:00:00
public class MaskedTextBox : TextBox
{
private string mask;
public string Mask
{
get
{
return mask;
}
set
{
mask = value;
this.Text = mask;
}
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (Mask != "")
{
e.Handled = true;
string newText = this.Text;
bool finished = false;
for (int i = this.SelectionStart; i < mask.Length; i++)
{
switch (mask[i].ToString())
{
case "0" :
if (Char.IsDigit(e.KeyChar) )
{
if(this.TextLength < mask.Length)
{
newText += e.KeyChar.ToString();
finished = true;
break;
}
else
{
newText=newText.Remove(i,this.SelectionLength);
newText=newText.Insert(i,e.KeyChar.ToString());
finished = true;
break;
}
}
else
{
return;
}
default :
newText += mask[i];
break;
}
if (finished)
{ break; }
}
this.Text = newText;
this.SelectionStart = this.Text.Length;
}
}
protected override void OnKeyDown(KeyEventArgs e)
{
e.Handled = true;
}
}
Create instance from this class and set its mask property
maskedText.Mask="00:00:00"; Note: you need to add more code to handle other keys like bakspase and other things
MCAD
-- modified at 20:49 Friday 9th September, 2005
|
|
|
|
|
Hello,
How can I remove all new lines from some text typed by the user in a multiline TextBox ? He must enter some long text, so I want it wrapped in several lines, but if he presses Enter (or Ctrl+Enter), I want to remove the new line at the end.
I could go searching the string for all Environment.NewLine (or '\n' and '\r' ) but I would think there's a more efficient way.
Any ideas? Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Just replace all newslines with spaces.
text = text.Replace(Environment.NewLine, " ");
---
b { font-weight: normal; }
|
|
|
|
|
This should work, thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Check this
string txt = textBox1.Text;
string outb = "";
for(int i=0;i
|
|
|
|
|
Sorry, I posted on the wrong question!!!
|
|
|
|
|
Yes,I'm lazy...what's the most straightforward way for vertical text?
|
|
|
|
|
If you want to display it in textbox, just split the string in it's characters and write one by one proceeded by new line.
|
|
|
|
|
Check this
string txt = textBox1.Text;
string outb = "";
for(int i=0;i outb +=txt[i]+"\n";
|
|
|
|
|
Use Matrix class to rotate by 90 and draw your text some thing like
Matrix matrix = new Matrix();
Point p=new Point(100,100);
matrix.RotateAt(90,p);
g.Transform = matrix;
SizeF size=g.MeasureString("Vertical String",this.Font);
RectangleF rect=new RectangleF(0,0,size.Width,size.Height);
g.DrawString("Vertical String",this.Font,new SolidBrush(Color.Blue),rect);
g.Dispose();
MCAD
-- modified at 20:12 Friday 9th September, 2005
|
|
|
|
|
Mohamad-- many thanks....
|
|
|
|
|
I'm using the following so I can format all my dates relvant to the current culture of the OS. The app is for global use
private DateTimeFormatInfo dtFormatInfo;
this.dtFormatInfo = Thread.CurrentThread.CurrentUICulture.DateTimeFormat;
I have then created a property to format any dates in ShortDatePattern
public string ShortDateFmt
{
get
{
return this.dtFormatInfo.ShortDatePattern;
}
}
Every time I run my application and process a date it returns in the format mm\dd\yyyy when running on an OS with United Kingdom setup (en-GB). en-GB date format should be dd/mm/yyyy
I have even created the follwing property so as to debug and check the CurrentUICulture
public string CurrentUICultureName
{
get
{
return Thread.CurrentThread.CurrentUICulture.Name;
}
}
and this is returning en-GB.
Any suggestions as to why the date is not formatting for en-GB
|
|
|
|
|
The ShortDatePattern does not specify the date separator, so when you use a pattern from a culture other than the current culture, the separator will still be taken from the current culture.
Use the CultureInfo object or DateTimeFormat object to format the date instead. They also contain information about the date separator.
---
b { font-weight: normal; }
|
|
|
|
|
okay I got my COM port settings being saved using XMLserializer but I cannot figure out how to get my settings to load from the XML file. Any help with this?
I'm using a class I found on Microsoft's website called CommBase. Here is my code to get the settings:
<br />
public bool LoadXMLSettings()<br />
{<br />
String XMLFileName = "Settings.xml";<br />
<br />
if (File.Exists(XMLFileName))<br />
{<br />
using(FileStream fs = new FileStream(XMLFileName, FileMode.Open))<br />
{<br />
miniterminal.CommBaseTermSettings ss = miniterminal.CommBaseTermSettings.LoadFromXML(fs);<br />
if (ss != null)<br />
{<br />
miniterminal.CommBaseTermSettings s = miniterminal.settings;<br />
MessageBox.Show(s.port);<br />
PortCombo.Text = s.port;<br />
fs.Close();<br />
return true;<br />
}<br />
fs.Close();<br />
}<br />
}<br />
return false;<br />
}<br />
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Rather than manually using the file stream to serialize bits and pieces of data, it may prove easier to simply throw the data you want saved into a class, then use System.Xml.Serialization.XmlSerializer to .Serialize() and .Deserialize() the class for you.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
|
Ok then, chances are you've got an invalid xml file (did you change the class since it was last serialized?). See if an error is being thrown in your catch clause.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Okay on exception I get "There is an error in xml document (2,2)".
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Sounds like the xml file is corrupted. Try deleting the existing (possibly old) xml file, save a new one, and try loading it. Do you still get the error?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Hey my parents live in chaska, and my sisters in Eden Praire
Tom Wright
tawright915@yahoo.com
|
|
|
|
|