|
You need to display the message box on the desktop. You can do this with this overload of the Show()[^] method. This overload allows you to specify additional options[^]. You want to specify the DefaultDesktopOnly option and (I think) pass null for the owner.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi all
while am writing to a text file using the way
PrintTextWrite.WriteLine(PSLNO.PadRight(3) + " " + PKCODE.PadRight(14) + " " + PITEMNAME.PadRight(45) + " " + PQTY.PadLeft(40) + " " + PRT.PadRight(11) + " " + PTOT1.PadLeft(20));
when PITEMNAME length increases there is alignment problem for PQTY & PRT & PTOT1
am i doing it proper way or is there any other way to set format for text file ???
thanks in advance
|
|
|
|
|
rowdykuttan wrote: when PITEMNAME length increases there is alignment problem for PQTY & PRT & PTOT1
Then check the lenth first, and if it is too large then truncate it. Or increase the space in the format.
|
|
|
|
|
am sending this text file to a DOT MATRIX printer, that too to a PREPRINTED STATIONARY, is there any way i can specify X & Y positions in text file or printer
|
|
|
|
|
rowdykuttan wrote: am sending this text file to a DOT MATRIX printer, that too to a PREPRINTED STATIONARY
You might like to specify that next time. It helps people understand your problem.
If you have a fixed external constraint like the size of preprinted paper then you have to truncate the information printed. Lop off a few characters. You'll find an appropriate method on the string class. Subseq, Substring or some such thing.
rowdykuttan wrote: is there any way i can specify X & Y positions in text file
If the file is formated as fixed length lines then you can calculate any XY position in the file and Seek to it.
(Y*LineLength) + X
LineLength includes the two character line feed and carriage return characters. It also assumes a fixed 8-bit character encoding.
|
|
|
|
|
If PITEMNAME's length is > 45, it is going to push everything over. You could truncate at 45 or you look at all the PITEMNAME values (assuming you are looping and trying to dump out data in columns) and set the pad accordingly rather than specifying 45.
If you are limited to your width and 45 is max, truncating is what I'd do, probably.
Good Luck!
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
Are you looking to do something like this?
1 George Washington April 30, 1789
2 John Adams March 4, 1797
3 Thomas Jefferson March 4, 1801
4 James Madison March 4, 1809
5 James Monroe March 4, 1817
6 John Quincy Adams March 4, 1825
7 Andrew Jackson March 4, 1829
8 Martin Van Buren March 4, 1837
9 William H. Harrison
March 4, 1841
10 John Tyler April 4, 1841
|
|
|
|
|
yes exactly but for William H. Harrison its comming in next line, i have left space for it like
1 George Washington April 30, 1789
2 John Adams March 4, 1797
3 Thomas Jefferson March 4, 1801
4 James Madison March 4, 1809
5 James Monroe March 4, 1817
6 John Quincy Adams March 4, 1825
7 Andrew Jackson March 4, 1829
8 Martin Van Buren March 4, 1837
9 William H. Harrison March 4, 1841
10 John Tyler April 4, 1841
i have enough space like this after name, plz tell me how to do it
|
|
|
|
|
You'll have to use <pre> tags in your response so I can see your formatting. Just modify your response, then I'll have another look.
|
|
|
|
|
1 George Washington April 30, 1789
2 John Adams March 4, 1797
3 Thomas Jefferson March 4, 1801
4 James Madison March 4, 1809
5 James Monroe March 4, 1817
6 John Quincy Adams March 4, 1825
7 Andrew Jackson March 4, 1829
8 Martin Van Buren March 4, 1837
9 William H. Harrison March 4, 1841
10 John Tyler April 4, 1841
|
|
|
|
|
Are you saying you want to adjust all the lines to account for the longest?
|
|
|
|
|
|
Ah, then scan through the data keeping track of the longest value length, then go through printing using those values.
|
|
|
|
|
Using vs05, I open the Data Source view, then click the Add New Data Source thing.
I add the database I want and all the tables show up. I can edit things using Edit DataSet with Designer without issue. Can preview data, and the results are what they are supposed to be.
Problem: When I try to drag a table to a form I get the error: “Length cannot be less than zero. Parameter name: length”
Any thoughts on what I’m neglecting to do here?
|
|
|
|
|
Seriously, don't use the wizards, don't drag and drop data connections. Write the code yourself - You'll be much happier, and it will work a lot better.
|
|
|
|
|
I'm glad somebody said that. I've never used the visual tools for database and was kinda starting to worry that I was missing out on something important. I even avoid using DataSets as much as possible, and I HATE the DataGrid.
|
|
|
|
|
How come it that you took the words out of my mouth?
I can only agree, i made the connections only once in one nice class and i reuse it in all my projects
|
|
|
|
|
ESTANNY wrote: How come it that you took the words out of my mouth?
It wasn't intentional. But the shock must have been quite something - It took you over 4 hours to recover and let me know!
|
|
|
|
|
This has so got to be a CE thing... because if I do what I’m trying in the full-blown framework, I’ve no problems at all.
In this CE, I can connect to the database using the wizards but, if I write the connection string, it refuses to connect.
It’s the same string, I copied it right out of the designer.
The length = 0 thing(from the first post) magically disappeared (no idea why, I didn’t do anything different when it stopped) but now even dropping a table on a form will give me a disturbingly vague “SQLException” error.
|
|
|
|
|
r u using windows or webapplication ?
|
|
|
|
|
Well, in this current edition… I’m developing in CE for little RF devices with almost no memory.
I’m going to try doing this programmatically, as was suggested, and see what happens.
Considering the lack of processing power on these things, I’m thinking about moving all processing to a server and accessing through WebMethods.
Assuming I don’t take a baseball bat to my computer
|
|
|
|
|
I want to Draw a Custom Background for the selected Item
Here is what I've tried
<br />
MyListBox()
{<br />
<br />
this.SetStyle(ControlStyles.DoubleBuffer, true);<br />
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);<br />
<br />
base.DrawMode = DrawMode.OwnerDrawVariable;<br />
<br />
this.DrawItem += new DrawItemEventHandler(this.DrawItemHandler); <br />
this.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.MeasureItemHandler);<br />
}<br />
private void MeasureItemHandler(object sender, MeasureItemEventArgs e)<br />
{<br />
e.ItemHeight = (int)(e.Graphics.MeasureString(this.Items[e.Index].ToString(), this.Font).Height);<br />
}<br />
private void DrawItemHandler(object sender, DrawItemEventArgs e)<br />
{<br />
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;<br />
<br />
if( e.Index == this.SelectedIndex)<br />
DrawItemBackground(e.Graphics, e.Bounds, Color.Peru);
else<br />
DrawItemBackground(e.Graphics, e.Bounds, Color.Pink);
<br />
e.Graphics.DrawString(this.Items[e.Index].ToString(), this.Font, this.writeBrush, e.Bounds); <br />
}<br />
Now, Everything shows up correctly initially but as I continue changing the selected Item the newer ones get painted properly but the old ones are not repainted. So all the items which are selected by me get painted in Peru. What I want is that only the one which the user selects gets its background painted in Peru and others Pink (repainted as non selected Items).
So Please Advice what am I missing.
Thanks...
|
|
|
|
|
You can't use the SelectedIndex property to determine how to draw the item. You need to use the e.State property to determine how to draw the item. like so:
if (0 != (e.State & DrawItemState.Selected)) {
}
else {
}
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
You Are the Man !!!
Thanks a Lot. I'm very very Happy.
Chak De!!!
|
|
|
|
|
I have been working with Active Directory in an app, and all has been fine til now I am able to get the current user that is logged on to our company domian, and get their full name based on that, by doing this:
WindowsIdentity user = WindowsIdentity.GetCurrent();
string u = user.Name;
u = u.Replace('\\', '/');
Console.WriteLine(u);
try
{
DirectoryEntry e = new DirectoryEntry("WinNT://" + u);
return (string)e.Properties["FullName"].Value;
}
catch (Exception)
{
return null;
}
Now, I want to get that users E-Mail address, but it will not return it. I have scoured every available resource, and I'm coming up with nada. From what I have read, returning the E-Mail address is as simple as changing
return (string)e.Properties["FullName"].Value;
to this:
return (string)e.Properties["mail"].Value;
anyone does this or have any ideas?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|