|
! that is some re-usability! ! the suggestion/guidence by Luc is proving to be great and actually bit simpler tooo Thanks PIEBALDconsult
|
|
|
|
|
I don't like to write single-use library functions, the more flexibility the better in my opinion, but the RegularExpression solution may be our best bet.
|
|
|
|
|
str = str.Replace(" ", " ");
the first argument in str.Replace is a 2 white space characters ( press spacebar twice )
the second argument in str is a 1 white space character ( press spacebar once )
Sorry, but I had to explain these arguments ion details, they are not correctly shown after the message is posted.
Hope this helps...
|
|
|
|
|
Dear all,
I have a treeview which I populate from a postgres database. This all works fine, and I'm using the following code :
DataRow newRow = dt.NewRow();<br />
dt.Columns.Add("Resources", typeof(System.String));<br />
<br />
if (dt.Rows.Count > 0)<br />
{<br />
treeView1.BeginUpdate();<br />
foreach (DataRow r in dt.Rows)<br />
{<br />
treeView1.Nodes.Add(new TreeNode(r["res_lastname"].ToString()));<br />
}<br />
treeView1.EndUpdate();<br />
}
Well, I'm not grabbing the data from the database directly but rather through a dataset.
I can add as many rows as I like, just by putting an extra line in , like this :
treeView1.Nodes.Add(new TreeNode(r["res_lastname"].ToString()));<br />
treeView1.Nodes.Add(new TreeNode(r["res_firstname"].ToString()));
Lastname and Firstname show up in the treeview below eachother :
-- Lastname
-- Firstname
Is there a way to show them right next to eachother , like this :
-- Lastname, Firstname
kind regards,
Rick
|
|
|
|
|
Rick van Woudenberg wrote: treeView1.Nodes.Add(new TreeNode(r["res_lastname"].ToString()));
treeView1.Nodes.Add(new TreeNode(r["res_firstname"].ToString()));
Have you tried this?
treeView1.Nodes.Add(new TreeNode(r["res_lastname"].ToString() + "," + r["res_firstname"].ToString()));
Regards,
Arun Kumar.A
|
|
|
|
|
I just did and it works perfect. I need a vacation, how could I miss that ? :-S
Thank you so much for your help and quick input.
Cheers !
|
|
|
|
|
No, you should query the fullname like
res_fullname=res_lastname+' '+res_firstname
and then use
treeView1.Nodes.Add(new TreeNode(r["res_fullname"].ToString()
|
|
|
|
|
Thank you for your reply, and your solutions seems to work as well.
Is there a significant difference in the two approaches, or is it just a matter of taste ?
Cheers ?
|
|
|
|
|
That was a joke, notice the smiley? (I guess I should have put it inside the message.)
|
|
|
|
|
Hello experts,
I'm working on a system which would be able to dinamically load all kinds of multiplayer games.
In order for the system to know how to handle any game, I set up some ground rules using an abstract class named GameEngine .
Among other stuff, it contains an abstract ProcessMessage() method.
At first I thought of loading DLLs from a special folder, and analyzing every class which inherits GameEngine .
But then came another thought into my mind...
What if someone, instead of implementing a game, inherits GameEngine and puts down malicious code into ProcessMessage() ?
My first solution is not to read DLLs from a directory, but to read only a DLL that I will code... Whenever I want to add another game, I would update the DLL...
However, this prevents other programmers from adding games to my program...
What can I do?
Thanks in advance,
Shy.
|
|
|
|
|
You should allow plugins, regardless of the security risks.
|
|
|
|
|
You should sign your plugins ( DLLs ) using Signcode.exe and also use a Dotfuscator like tool to prevenet (as much as you can) your dlls from being disassembled to their original source code. Don't forget SecurityPermissionAttributes which also add another level of protection to your distributed plug-ins(DLLs). Checkout:
Web site: http://msdn2.microsoft.com/en-us/library/ab4eace3(vs.71).aspx
MSDN Library: Assembly Security Considerations
Hope this helps...
|
|
|
|
|
Hello!
I made a small C# application where you need to enter float numbers.
In the Dutch language/math they write floating point numbers with a ',' so for instance 1,5
In English they write a dot like 1.5
The strange thing is that in my application only floating point number with a comma are entered correctly.
Could someone tell me why this is? When I would enter 1.234 my program thinks it means 12.34, only when I type 1,234 this float is entering my program correctly...
Could anybody tell me what is happening here, I would prefer to use the English version only! But maybe .NET sees that I have a Dutch PC?
Ranger.
Novice
|
|
|
|
|
I have been looking around and found an interface called IFormatProvider but that this stuff is really complicated.
It has to do with local standards, how countries have different ways of displaying things.
Just like I expected.
Can you switch off this local way of interpreting information?
Ranger.
Novice
|
|
|
|
|
Ranger49 wrote: Can you switch off this local way of interpreting information?
Yes, if you pass CultureInfo.InvariantCulture as IFormatProvider.
-- modified at 8:08 Sunday 6th May, 2007
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
dnh wrote: Yes, if you pass CultureInfo.InvariantCulture as IFormatProvider.
Thanks! This is exactly what I needed to know!
Ranger.
Novice
|
|
|
|
|
Pass NumberFormatInfo as the IFormatProvider.
Hope this helps...
|
|
|
|
|
Hi all,
i want to know how can I add data in a form from another form and display it in a datagrid after adding it to the first form
pleeease help
thanx
|
|
|
|
|
|
it will best if you use event handler in Child Form
and Call it from Parent Form.
class FrmChild
{
public event System.EventHandler addData;
.........
......
}
class FrmParent
{.....
private void btnSchduler_ClickEvent(......)
{
FrmChild obj=new FrmChild();
obj.addData +=new EventHandler(objServices_addService);
obj.ShowDialog();
}
private void objServices_addService(object sender, EventArgs e)
{
//write code to Add in Data Grid....
}
}
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
First I decrypted your question
Then I found out that, you can do it by creating a new constructor which takes a datatable in the second form. Then from first form, you send the datatable to the second forms constructor where it is used as Form2.CustomDataGrodView.DataSource = datagridViewFromConstructor. Or you can add a property(public DataTable NewDataSource {get; set;}) or method like (UpdateDataSource(DataTable newDataSource)) then call these from your First Form with a new DataTable.
Hope this helps...
|
|
|
|
|
Hello,
I'm Trring to insert,update and delete throught a DataGrideView by using code
But I don't Know How .I need for help in how to select the appropriate Events.
Thanks.
Dad
|
|
|
|
|
try this article
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
DataGridView.Rows.Add(...)
DataGridView.Rows.Remove(...)
DataGridView.Rows.Insert(...)
Checkout MSDN Library for these methods.
Hope this helps...
|
|
|
|
|
I have a question(s) that I hope someone can answer. I know how to make a picture box either visible or invisible and also how to load one image into it.
The questions are: Can more than one image be loaded into a picture box at one time? If so how is it done and how do you show each picture when needed? If it can't be done, what are my alternatives?
I'm trying to get three pictures into the same picture box area, and show each in turn as a specific button is clicked.
Thank you for any help or suggestions that are forth coming.
|
|
|
|