|
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")
|
|
|
|
|
Figured it out. For some dumb reason you have to do a directory search by the users full name. doing a directory entry for the user, then doing Email properties won't work
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Hello everyone,
I'm now searching about 6 houres to a code, which can change the source IP Address of a IP Packet.
I will send a Packet from my computer (10.48.0.80) to my teacher (10.48.0.121), he will watch the packet traffic with Wireshark. Now he give me the job to search a possible way to change the Packet Source IP which I send to his address.
First I have searched, which socket I have to take: RAW like this:
Socket iSock = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
So, how can I send packets witch the same source and destination IP??
Greets
Stephan
(PS: Sorry for my bad english )
|
|
|
|
|
naezl wrote: First I have searched, which socket I have to take: RAW like this
As far as I'm aware. Raw sockets are not supported from XP SP2 onwards due to the security risks.
You can write an NDIS driver to modify the packet at the network card interface. But that won't be in C#. You'll have to use C or C++
|
|
|
|
|
I need an easy way for user to open my application without the need install dot net framework on his device. If there is no way, I need to no the shortest time consuming version to install?
|
|
|
|
|
If you are running a .NET app, then you have to install the framework, run it as an ASP.NET application or package all of the framework into one executable. The best way to install the framework is to include the .NET redistributable in your installer as a dependency.
There are applications that will merge your application and the .NET runtime together but they do tend to be really expensive and seem to work with varying degrees of success.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
unless you're willing to $pend big buck$ on a tool to natively compile .net apps you need the framework you built the app with on the machine. The 1.0 framework is the oldest, smallest, and presumably fastest to install; but you need VS02 to build with it and it's significantly less capable than newer versions.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
dan neely wrote: The 1.0 framework is the oldest, smallest, and presumably fastest to install;
and with lot of shortcomings and limitations too...
|
|
|
|
|
Vasudevan Deepak Kumar wrote: dan neely wrote:
The 1.0 framework is the oldest, smallest, and presumably fastest to install;
and with lot of shortcomings and limitations too...
I said that: ...it's significantly less capable than newer versions.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
hi guys can u help me about how i can record a value which comes in textbox,in txt file??? i wanna do win application..so when i click button i wanna save in txt
|
|
|
|
|
Create a FileStream .
Create a StreamWriter that uses the FileStream object.
Write the Text to the file.
Close the StreamWriter and the FileStream .
|
|
|
|
|
in my application when user adds sth to the db i want to refresh the details updated andshow it to the user, to do this currently i'm using a little trick .. instead of doing this i want really to get the updated info from the db.do i have to reconnect to the db each and every time the user update the db ,OR do i have any other solution .. your suggestions please..
|
|
|
|
|
If you want the data to be read from the db, then you have to connect.
What I think you should be doing is having a data access layer, beneath the businses object you are displaying. If you are displaying a 'person', you would have a person data object. When you have data to save, get the front end / business layer to write the changes to the data layer. This layer should have a 'Save() / Write() / Commit()' method, which you can call when you need to, which will commits the data to the database. This way, the data layer is always in sync with the DB (Assuming nothing else writes to the DB), and you shouldn't need to read from it, only when first loading the object.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|