|
No matter what games I play with its properties, ToolstripLabel doesn't seem to want to display its .Text unless the control is wide enough to accomodate the entire string.
It's probably me, but I'm hungry, tired and cold (serve me right for moving north) and only have the turkey feasted CP community to turn to. A nudge in the right direction ("south" is not a good answer) would be much appreciated.
Thanks,
/ravi
|
|
|
|
|
Are you trying to set the .Text from Code or Designer? I think the width of ToolstripLabel automatically increased depend on your text..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
I'm setting its text from code. The control's width can be dynamic or fixed depending on its AutoSize property. However, its width is upper bounded by the parent toolstrip's width. All this makes sense.
What doesn't make sense (to me) is why the control isn't able to render the portion of the text that lies within the control's current width, like a vanilla Label control.
/ravi
|
|
|
|
|
Wouldn't it support a dynamic width? Of course, I admit, that we should not get deeper into its internals making our code spagetti. But just trying to ensure that we don't leave any stones unturned.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Vasudevan Deepak Kumar wrote: Wouldn't it support a dynamic width?
Yes, it does. The problem is no text gets rendered unless it completely fits within the control's current width. Unlike a vanilla Label which will render a portion of the text.
/ravi
|
|
|
|
|
hi ,
can any one help me to get the code for displaying all the country names and their cities in c#.net
regards
ram
|
|
|
|
|
You may check this link to know about how to bind the data with DropdownList.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
|
|
As a guess, i'd say the problem lies with retreiving the data from another class, especially if the data 'appears' to be loading. So how are you doing that?
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
I just checked to see if the data is there with the following:
//****************all fields below do not show data ***********************
//****************this is from another class ******************************
DataSet dsI = new DataSet("BSD");
DataSet1.BSDDataTable BSD = new DataSet1.BSDDataTable();
int nRecord = BSD[2].nRecNumID;
string strName = BSD[2].strName;
int nSIC = BSD[2].nSIC;
********* Below is the code for loading and is marked where I checked it after loading*******
nUseRecNumID = 0;
//BSD.BeginInit();
//BSD.BeginLoadData();
//BSD.Clear();
Rowset.MoveFirst();
while (!Rowset.IsEOF)
{
if (nUseRecNumID < (Int32)Rowset.GetData(1))
{
// These lines ensure all records are incremented by one and
// RecNumID equals record number.
DataSet1.BSDRow dr = BSD.NewBSDRow();
dr.nRecNumID = nUseRecNumID;
BSD.AddBSDRow(dr);
}
else
{
if (Rowset.GetData(1) != null) nUseRecNumID = (Int32)Rowset.GetData(1);
DataSet1.BSDRow dr = BSD.NewBSDRow();
if (Rowset.GetData(1) != null) dr.nRecNumID = (Int32)Rowset.GetData(1);
if (Rowset.GetData(2) != null) dr.strName = (String)Rowset.GetData(2);
if (Rowset.GetData(3) != null) dr.nSIC = (Int32)Rowset.GetData(3);
BSD.AddBSDRow(dr);
dr.AcceptChanges();
Rowset.MoveNext();
}
nUseRecNumID = nUseRecNumID + 1;
}
//BSD.EndLoadData();
BSD.AcceptChanges();
//dsI.Tables.Add(BSD); //add the table BSD into dataset
//***********************Reads data here****************************
//****************all fields below show data ***********************
int nRecord = BSD[2].nRecNumID;
string strName = BSD[2].strName;
int nSIC = BSD[2].nSIC;
//******************************************************************
-- modified at 0:41 Friday 23rd November, 2007
|
|
|
|
|
MAW30 wrote: I continue to get the folowing error "There is no row at position {X}",
What does the DataSet Visualizer of Visual Studio 2005 show during the debugging session?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
What is the DataSet Visualizer?
Michael
|
|
|
|
|
This is true you are facing problems....
But what is this..?
"I will give more detail in the email and notes about where the problem is it is a very small sample "
Do you want other will code for you...? This is not fare....
If you have many notes and suppose to send the code then why are you not posting here...?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
I am not asking you to code anything for me, only to look it over so you may see everything. There is too much code to post it all, the notes are exactly what I ended up posting anyway. If you would like to look at it I will send you a copy.
Michael
|
|
|
|
|
I think their is a problem to passing the data between two classes.
Please ensure that you are returning the right dataset from your function and after filling it you won' using the new keyword.
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
When I remove the new as follows I get the folowing error message:
DataSet dsI;
DataSet1.BSDDataTable BSD;
error message when trying to compile.
"Use of unassigned local variable on BSD"
How do I get around this problem.
Michael
-- modified at 2:38 Friday 23rd November, 2007
So to solve that problem I changed the code to the following:
DataSet1 dsI = new DataSet1(); ( It seems I need to return to this)
DataSet1.BSDDataTable BSD = dsI.BSD; (Object reference not set to an instance of an object)
but I end with the original error "There is no row at position 2"
|
|
|
|
|
Hi All,
Here I go again
I derived an EncodingException from Exception . In my code, when I catch an OverflowException I throw a new EncodingException . The catch and new-throw executes fine.
However, the code I am trying to guard never catches an exceptions. I've read Jeffrey Richter's chapter on Exceptions in CLR via C#[^]. This behaior is neither expected or documented. The guarded code is below. The EncodingException class will be hung off this thread. Any ideas why no exceptions are being caught?
Thanks,
Jeff
int Eaten = 0;
try
{
Eaten = TryParseNested(BytesToConsume);
}
catch (EncodingException ex)
{
Debug.Print(ex.Message);
return -1;
}
catch (OverflowException ex)
{
Debug.Print(ex.Message);
return -1;
}
catch( Exception ex)
{
Debug.Print(ex.Message);
return -1;
}
|
|
|
|
|
[Serializable]
public sealed class EncodingException : Exception, ISerializable
{
private int _Offset = 0;
public int Offset
{ get { return _Offset; } }
public override string Message
{
get
{
StringBuilder builder = new StringBuilder(base.Message);
builder.AppendFormat("Illegal encoding encountered at " +
"Offset {0}{1}", _Offset, Environment.NewLine);
return builder.ToString();
}
}
public EncodingException() : base() { }
public EncodingException(String message) : base(message) { }
public EncodingException(String message, Exception innerException)
: base(message, innerException) { }
public EncodingException(int offset) { _Offset = offset; }
public EncodingException(string message, int offset)
: this(message) { _Offset = offset; }
public EncodingException(int offset, Exception innerException)
: this("", innerException) { _Offset = offset; }
public EncodingException(string message, int offset, Exception innerException)
: this(message, innerException) { _Offset = offset; }
private EncodingException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_Offset = info.GetInt32("Offset");
}
[SecurityPermission(SecurityAction.Demand, SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("Offset", _Offset);
}
}
|
|
|
|
|
forgot to mention: there is a project property (Build/Advanced) to check
OFL/UFL everywhere too.
-- modified at 21:23 Thursday 22nd November, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Luc,
Thanks. It does not matter. This will be my last project with this f***ing language. I am totally disgusted by it's behavior and bugs. It's a damn shame I have so much time into this garbage language for this project.
Here is something else which does not work: take the try wrapper off the Method causing the overflow (it is an int.Parse() method). I check the string length before calling int.Parse. If too long, I throw the EncodingException so that C# never generates it's exception.
Guess what the result is... No catch.
Jeff
|
|
|
|
|
Hi Jeff,
I am surprised you got such problems with C#. I've done over 100K lines of code in C#
in the last three years, and never had real problems with it. It works fine for me.
If you want my opinion/advice on your Exception problem, please post the relevant pieces
of code. What are the VS and .NET versions you use?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Jeff,
this is what MSDN tells us on OverflowException:
In languages that detect overflow, OverflowException is the exception that gets thrown. For example, in C#, the checked keyword is used to detect overflow conditions. An OverflowException exception occurs only in a checked context.
So by default you get none...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Luc,
Luc Pattyn wrote: So by default you get none...
I actually catch it. It's when I throw the EncodingException that the missed catch problem occurs.
I feel like I need an MSDN substciption with this language. There are too many inconsistencies and bugs. I'd like to call Microsoft, place the bug report, and wait for an answer rather than spending hours trying to find my own work arounds.
Jeff
|
|
|
|
|
Jeffrey Walton wrote: Any ideas why no exceptions are being caught?
If your code has no error then no exception will be caught.
If you want OverflowException exception then try the code below.
short shorty = 32767;
int integer = shorty + 1;<br />
try<br />
{<br />
checked
{<br />
shorty = (short)integer;
}<br />
}<br />
catch ( OverflowException e )<br />
{<br />
Console.WriteLine (e.Message);<br />
}
If you want EncodingException (the custom exception that you created), you have to throw this exp like the example below
int Eaten = 0;<br />
try<br />
{<br />
throw new EncodingException("this is encoding exception");<br />
}<br />
catch (EncodingException ex)<br />
{<br />
Debug.Print(ex.Message);<br />
<br />
return -1;<br />
}<br />
<br />
catch (OverflowException ex)<br />
{<br />
Debug.Print(ex.Message);<br />
<br />
return -1;<br />
}<br />
<br />
catch( Exception ex)<br />
{<br />
Debug.Print(ex.Message);<br />
<br />
return -1;<br />
}<br />
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|