|
You can't protect the object itself, but you can return a copy:
<br />
private Something s;<br />
public Something S{<br />
get{ return s.Clone(); }<br />
}<br />
For a Hashtable, you have to copy the content yourself. Hashtable.Clone() return only a flat copy.
<br />
public Hashtable Table{<br />
get{<br />
Hashtable htCopy = new Hashtable(ht.Count);<br />
foreach(object key in ht.Keys){<br />
htCopy.add(key, ht[key].Clone());<br />
}<br />
return htCopy;<br />
}<br />
|
|
|
|
|
Hello,
I have two tables From one table i want to retrieve two values and from the other also two values. And the condition is when the one value of the first table has a certain value. (In my case EngineerUserId). The problem is with my current statement the rows will be displayed two times.
Have anybody know an idea?
My current statement looks as follows:
"SELECT p.JobId, p.Priority, c.CompanyName, c.ContactLName FROM JobDescription p INNER JOIN Client c ON p.EngineerUserId = ? ORDER BY p.Priority";
thx
patrick
|
|
|
|
|
pat270881 wrote:
SELECT p.JobId, p.Priority, c.CompanyName, c.ContactLName FROM JobDescription p INNER JOIN Client c ON p.EngineerUserId = ? ORDER BY p.Priority
Do you mean the ? as a parameter placeholder of that you don't know what you should put there.
If it is the latter then:
INNER JOIN Client p.EngineerUserId = c.EquivalentColumnNameInClientTable
If you need to add a condition you should add a WHERE clause before the ORDER BY
so you might get something like this (I've assumed that the client table has a column called EngineerUserId, if it doesn't you need to replace it with the column that does contain that value)
SELECT p.JobId, p.Priority, c.CompanyName, c.ContactLName
FROM JobDescription p
INNER JOIN Client c ON p.EngineerUserId = c.EngineerUserId
WHERE p.EngineerUserId = ?
ORDER BY p.Priority
Oh, and by the way, this should really have gone in the SQL Forum[^]
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Okay, thank you, now it works!
Thx
patrick
|
|
|
|
|
Hello,
Is it possible to set the Background of a certain Tab Pane of the Tab Control? - And where does appear the icon which i can set in the Designer in VS.NET in a Tab Control?
thx
mathon
|
|
|
|
|
It concerns a Smart Device Application.
|
|
|
|
|
Hello,
In addition to that how can I find out what tab pane of the tab control is currently selected?
Regards
patrick
|
|
|
|
|
pat270881 wrote:
In addition to that how can I find out what tab pane of the tab control is currently selected?
its a good idea to check the object browser before posting, in this case the TabControl exposes a public property named "SelectedTab"
|
|
|
|
|
But in the Object Browser is not quoted which event occurs when I go from one tab pane to another tab pane..?? - and I also did not find a background property for the tab pane?
patrick
|
|
|
|
|
pat270881 wrote:
But in the Object Browser is not quoted which event occurs when I go from one tab pane to another tab pane..??
Yes, there is. It's called SelectedIndexChanged .
pat270881 wrote:
and I also did not find a background property for the tab pane?
That's because there isn't one. Changing the background color of the Tab pane isn't supported by the default implementation. You'll have to owner draw the TabControl in order to change the background color of a single pane.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Okay, i have built a wonderful, slick application that is a deep, convoluted call-tracking system of sorts. There is an approval process built in, that uses email addresses to identify the approvers.
the problem is, there are required approvers that exist in multiple places, resulting in some people being listed more than once.
Essentially, here is what i have been running into. the names are strung together like this:
user1*user2*user3*user4
except sometines, you end up with
user1*user2*user3*user4*user2*user1
what i have been killing myself over, is trying to make a quick function that would look at this list, say "we already have user's 1 and 2, so only list them once".
I spent 4 hours on this yesterday, and ended up with an extremely complicated way to turn "user1*user2*user3*user4*user2*user1"
into
user1
user2
user3
user4
user2
user1
which, of course, can be done with 3 or 4 lines of code, not the 50 something i made yesterday. any ideas?
Yes, I am the highly suggestable type.
|
|
|
|
|
You mean something like:
String strUserList = "user1*user2*user3*user4*user2*user1";
char[] sep = {'*'};
Array a = strUserList.Split(sep);
(written without a compiler, so might not be syntactially perfect..)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Pretty much how i split it up, i just now need to squish that array so that there is only 1 of each item.
Yes, I am the highly suggestable type.
|
|
|
|
|
ArrayList?
ArrayList list = new ArrayList();
foreach(string str in mySplitArray)
{
if(!list.contains(str))
list.add(str);
}
|
|
|
|
|
Beeeeeeautiful!! Worked perfectly!
Thank you, youjust made my day
Yes, I am the highly suggestable type.
|
|
|
|
|
a very simple way would be to use nested for loops
quick pseudocode:
for (a=0..size)
for (b=0..size)
if array[a] == array[b]
array[b]=""
endif
endfor
endfor
then just check for, and ignore empty strings
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Hi,
I'm having problems with the measureString function. I am trying to measure the length of a string the user types into a text box. However, the size in pixels that this function returns is different than what is displayed on screen. This causes a visual overflow from the text box rectangle for some inputs.
I've tried using measureCharacterRanges instead and the same problem still arises. A partial solution is supplied by using the function getTextExtentPoint32. Using getTextExtentPoint32 no input overflows, but some inputs are truncated before the end of the text box.
Do you know of any other function that will supply a full solution?
Thanks,
Shimrit
|
|
|
|
|
Hello,
Iam new to c#
My Problem is something like this.
Create a sample windows application, having 2 textboxes & a command
button
Set the forms controlbox property to True
Write validation event for the 2 textboxes
private void txtpassword_Validating(object sender,System.ComponentModel.CancelEventArgs e)
if (txtempno.Text=="" | txtpassword.Text=="")
{
MessageBox.Show("Please Enter User Id and password","Invalid Data",MessageBoxButtons.OKCancel);
e.Cancel = true;
}
while running the application when the user clicks the button1
the focus is still in 1 of the textboxes, the validation event of the textboxes still fire.
Same is the case when the user clicks the X button on the control box.
i.e validation event is fired and form is not closed
Form Causesvalidation property aslo set flase.
if i write the code in the Form1_closing event then also the problem is not being solved.
This is because the validation event of the textboxes is fired first so the execution never reaches the Form1_closing event.
i need to provide this funcationality in my application,How can i do this?
|
|
|
|
|
Not a 100% sure this will solve your problem, as I dont really understand the question, but just in case its a simple as:
boolean or ||
bitwise or |
if (txtempno.Text=="" | txtpassword.Text=="")
should read
if (txtempno.Text=="" || txtpassword.Text=="")
|
|
|
|
|
Hello ppl... I still trying to build my Remoting Application. And now I need ideas of how to make my communication secure between my web server and my application server (component). Somebody knows how to make it secure? I want to use a TCP Channel. I read some about Trusted Subsystem and I wanna know if this is what I really nedd. Someone has a code of .NET Remoting Trusted Subsystem?
Thank you all....
Wender Oliveira
.NET Programmer
|
|
|
|
|
Hello All,
I have developed some custom contorls for extra functionality such as MyTextBox inherited by TextBox and few others. But whenever i shift the project to some other machine, Forms containing those texboxes either doesn't open showing 'Designer error' or if they openn they dosnt display those controls at design time. (if i run the application it works fine but at design times it misbehaves)
Any Solution?
Thanx in Advance
sorry for my bad English.
|
|
|
|
|
Try to add reference to System.Design.dll... this lib doesn't shows on Visual Studio when you go to Add Reference. So you must to browse it on Framework folder
Wender Oliveira
.NET Programmer
|
|
|
|
|
I've been developing in C++/MFC for around 8 years, and we've decided to finally bite the bullet and upgrade from Dev Studio for VC++6 to the upcoming VS 2005, get to grip with .net and look at C#.
I need to get up to speed fairly quickly, so I make recommendations on where we go and how, so I'm after some material (a book probably) that will lead me along this route.
Can anybody recommend a good book, or even a set of tutorials aimed at my situation?
Thanks,
Mike.
|
|
|
|
|
Troelsen's "C# and the .NET Platform" is my bible - heartily recommend it.
ISBN: 1-59059-055-4
|
|
|
|
|
Congratulations, you have taken a good decision.
If you are in a hurry, but still want to make a firm grounding in C# and .NET just buy these three books and start reading... The last one is more suited as a reference than as a start to end read...
Applied .NET framework programming - Jeffrey Richter
Inside C# - Tom Archer
Professional C# - Wrox
Best of Luck!
|
|
|
|