|
Hi,
I recommend using a ListBox instead of a TextBox when ever the content is line oriented.
A TextBox is meant to hold one piece of text, and it effectively stores a single string,
which would be the (expensive) concatenation of all your individual log messages.
A ListBox on the other hand is aimed at displaying and manipulating lists, that could be lists of single-line strings. Nothing gets concatenated, all items in the list are kept separately, and they can be added, removed, modified, etc. Much easier, and much faster, especially when the total size of the contents increases. I have been using ListBoxes holding millions of messages; I can't imagine getting satisfactory results from a TextBox for such work loads. A StringBuilder would not solve the performance problem at all.
|
|
|
|
|
Agree with Luc, use a ListView, change the view to detail, add a single column, and make de column width be the same as the listView (you may handle the onResize event of the listview to make it work ok)
You can use a rich text box too but will be more complicated to delete all data
Saludos!!
____Juan
|
|
|
|
|
To put things straight, I mentioned ListBox, not ListView (maybe ListView can be
as performant as ListBox, but I am sure ListBox is the easiest one to use).
And RichTextBox is in no way easier or cheaper to use for line-oriented output as
a standard TextBox is.
BTW if I need minor formatting (say optional styles such as bold, or a few colors,
then I turn the ListBox into an OwnerDrawn one, and either store strings with a
special first character, or store objects of a very simple class holding text plus
some style flags.
|
|
|
|
|
|
I need to read some file from over 200 different pcs and then insert them into the database. The application should not hang if it can not read from one pc due to whatever reason so I am thinking of doing the read asynchronously and when done will be directed to a routine which will insert them into db. I need to do some work with the data first before inserting into db so I am taking the csv file contents and putting them into a DataTable object. Is this Ok or are there any precautions I should take?
What should I watch out for?
What can go wrong?
Should I use Async or it is not needed?
Thanks,
|
|
|
|
|
I am amazed to find that nothing exists (that I can find from a internet search and here at CP) to suspend a windows form from updating itself.
I've tried suspendlayout and resumelayout methods of the form with no luck.
I see calling the win32 api is one way but wow, this could easily be done in VBA with "ScreenUpdating=false" then set to true again when you wanted to hide screen happenings from the user.
My needs arise from programmatically setting some control's (comboboxes, textbox) values that I don't wish the user to see necessarily.
Any ideas?
|
|
|
|
|
Why would you set values to controls if you don't want the user to see them ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
The user will use the controls to input information of course. But, I want the user to be able to do a "quick entry" of sorts, by a less onerous method via some other controls (radio buttons) that, based on these simple choices, cause code to programmatically set the values of these other more numerous controls (with their events firing etc that I want).
What my goal is by this design is to 1)make common entries faster for the user to enter and 2)ensure the logic (there's quite a bit of interactions of the controls) of these controls to be the only path of creating the data that the user will be storing via the app. ..so it's a single pathway of logic/code/bug opportunity & fix, in determining the many data elements that the user needs to indicate to the app for what they need to store.
Anyway, since my original post I found that I could just set the container of the controls, in this case a tabpage of a tab control, to not visible for the time in question, then set it back to visible afterwards. That seems to work well enough. . .I was just surprised to not have another way of doing what had been available in VBA.
I guess if one had a bunch of controls on a form and wanted the user to see them but also have done what I am aiming at then it would be a little more difficult without the way that is easy in VBA (screenupdating=false).
|
|
|
|
|
OK. Well, what you're doing seems the most sensible way of achieving that to me. I'd just think if you have a quick entry method, there's no reason for the client not to see the result. But, you understand your business rules better than I do, I guess.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
If i have employee class properties such as ID and Name then i can get their data respectively through the attributes. Is it possible to get the entire employee object rather than getting the individual property data. I mean how can i delcare an attribute that can hold the class reference where it is delcared
public class Employee
{
[TypeConverter(typeof(EmployeeID))]
public string ID
{
get{return id;}
set{id=value;}
}
[TypeConverter(typeof(NAME))]
public string Name
{
get{return name;}
set{name=value;}
}
}
|
|
|
|
|
updatecom.CommandText="update test2 set name='" + textBox1.Text + "' job= '" + textBox2.Text +"' title='" + textBox3.Text + "'where id=" + textBox4.Text + "";
Ahmed hassan
|
|
|
|
|
try some comma's between the ' and job and ' and title
|
|
|
|
|
|
And as an addition to the previous post, use parameters for values. You are now for example vulnerable to sql injections.
|
|
|
|
|
1: instead of saying 'not working', tell us what the error is. Putting commas in to fix your SQL will obviously work.
2: read up on SQL Injection attacks, to find out how I can erase your entire database if you release this code
3: tell me you're not really using variables called textBox1, textBox2, etc. Or are you trying to write unreadable code on purpose ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
You may try this:
updatecom.CommandText = "update test2 set name='" + textBox1.Text + "', job= '" + textBox2.Text +"', title='" + textBox3.Text + "' where id='" + textBox4.Text + "'";
Fixed "," and "'"
Saludos!!
____Juan
|
|
|
|
|
Hi,
This might seem pretty basic but can anybody explain why and/or when a method should have the static or virtual? i.e.
public static void Method1()
{}
Thanks,
Prateek
|
|
|
|
|
|
I guess i should have checked msdn first before posting the question.
Thanks
|
|
|
|
|
|
I have a standard Calendar Control:
<asp:calendar id="calNewFirstDateAvailable" runat="server" tooltip="Select First Available Date" xmlns:asp="#unknown">
</asp:calendar>
And I am attempting to set a specific Date as the highlighted date programatically, but it is not highlighting the day in the control.
calUpdateFirstDateAvailable.SelectedDayStyle.BackColor = System.Drawing.Color.Black;
calUpdateFirstDateAvailable.SelectedDayStyle.ForeColor = System.Drawing.Color.White;
calUpdateFirstDateAvailable.SelectionMode = CalendarSelectionMode.Day;
calUpdateFirstDateAvailable.SelectedDate = atsi.StartDate;
calUpdateFirstDateAvailable.VisibleDate = atsi.StartDate;
atis.StartDate is a DateTime type with the value of '{11/12/2008 11:09:03 AM}'
What am I doing wrong?
Any Help would be greatly appreciated.
VS2008 .net 3.5
Thanks,
Robert
|
|
|
|
|
This may be completely wrong, but I recall the order you set the properties may have an affect on what and when is displayed.
BTW: ASP.NET questions belong in the ASP.NET forum.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hello,
I can't seem to find any info regarding this because I don't know what to look for. I really have tried looking on the net, looking on here, searching both articles and message boards, and nothing is quite what I'm needing.
What I'm trying to do is find a component that shows the contents of my drive, similar to looking at the Desktop in the Explorer.
I would also like to have checkboxes next to the folder names so that a user can select multiple folders. Checkboxes are preferred, but if Ctrl+Select is the only option, then ok.
Something like this is out there... I know I've seen it somewhere, but just can't find out what it's called, or any code that uses it as an example.
Any suggestions?
Thanks,
Michael Fritzius
|
|
|
|
|
There's nothing that's standard, it would have to be a user control of some sort.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
That's fine--I'm not set on using anything standard anyway. But I wouldn't even know how to make my own control for this application. Has anyone made something like this?
|
|
|
|