|
Tapas Saha wrote: I am trying to find Then Google is the tool of choice.
Veni, vidi, abiit domum
|
|
|
|
|
Why? Microsoft is actively discouraging the use of icon overlays.
|
|
|
|
|
Well, "...I want to change file and folder default icon same as dropbox..." what it means?
What is your dropbox? There is no answer if you suggest your problem clearly.
|
|
|
|
|
Hello WuRunZhe,
Thanks for your reply.
Actually on dropbox after sync new file and folder a green trick mark added on file and folder icon. I want something like that.
Please suggest...
|
|
|
|
|
I have 2 forms --> Form1 and Form2
Both contain a textbox(textbox1).
Form2 have a button. When I click on that button i want to take the text from Form2.textbox and paste it into Form1.textbox.
How to do that?
Thanks.
|
|
|
|
|
You have not done even the minimum research on this one. Have some Google Foo[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I knew your brother, Sherlock.
the solution was interesting but none of you give it right.
I give you the credits because you suggested what to search for ... but you did not helped.
The solution:
public partial class Form1 : Form
{
Form2 f2;
public Form1()
{
InitializeComponent();
f2 = new Form2();
}
private void button1_Click(object sender, EventArgs e)
{
f2.firstValue = textBox1.Text;
f2.ShowDialog();
label1.Text = f2.secondValue;
}
}
public partial class Form2 : Form
{
public Form2() {InitializeComponent();}
public string firstValue,secondValue;
private void Form2_Load(object sender, EventArgs e)
{
label1.Text = "Welcome " + firstValue;
}
private void button1Build_Click(object sender, EventArgs e)
{
secondValue = textBox1.Text;
this.Hide();
}
}
|
|
|
|
|
f2.ShowDialog();
I just tried a similar test and the second form shows just fine.
Veni, vidi, abiit domum
|
|
|
|
|
f2.Show(); well, maybe in THIS particular case is NOT suppose to work.
i dont know and i dont care - i solved my problem. lol
|
|
|
|
|
Please don't do that - making your fields public is a very bad idea: use properties instead.
And the Show does work - but you probably don't understand the difference between Show and ShowDialog.
f2.firstValue = textBox1.Text;
f2.ShowDialog();
label1.Text = f2.secondValue;
Waits until the Form2 instance is closed before executing the following line.
f2.firstValue = textBox1.Text;
f2.Show();
label1.Text = f2.secondValue;
Returns immediately and executes the following line straight away, before your user has any chance to type a new value.
|
|
|
|
|
Ohooo, my Christmas is coming early for me - Now, that is a real helpful answer - you should be proud.
I am. And i thank you for clearing it up.
The global var, is the best thing to do because they are not using much space (like the properties does with a lot of script - get then set, not good for the coder at all). Maybe they(properties) are good in some VERY particular(i dont really know them) cases but not in all. I think with global var you maintain a lighter and easier code.
|
|
|
|
|
_Q12_ wrote: The global var, is the best thing to do because they are not using much space
(like the properties does with a lot of script - get then set, not good for the
coder at all). Maybe they(properties) are good in some VERY particular(i dont
really know them) cases but not in all. I think with global var you maintain a
lighter and easier code.
Well, actually every Project that contains more than 2 classes is worth the effort to use
properties. It's not about the space, i think we are not living in times of
"Dude my app is to big for that pc, i need to reduce code", anymore.
I prefer properties because i know what is allowed to get out and into a class by restricting it with getters and setter. And not having global vars flying around!
If you actually need global vars, use a globals class and share that one to all your other classes.
Sorry alot of offtopic ....
if(this.signature != null)
{
MessageBox.Show("This is my signature");
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Devils advocate here. If you aren't serialising and you aren't doing anything other than setting a field in your property, then what is the point of your property? They tend to be overused because there is this dogma that they promote encapsulation - they don't, if your class needs to change the property (say to add a multiplier into place), then you can as easily wrap the field up into a property at that point.
|
|
|
|
|
Thanks for this additional thought.
This shows me that my explanation was not clear enough.
But it is my opinion on using properties, I never wanted to state that this is how you have to di it
Addidionally it's my style of writing code.
But back to the sense of properties.
I use it for restricting the values that go IN and OUT, so not only Setting variables
Secondly, yes for only Setting variables it might be oversized, therefore i referenced to a globals class that holds this variables, yeah this is just shifting space requirements around you'd say.
An example for what properties are used , imo:
public class Person
{
private string name = "";
private DateTime birth = DateTime.Now;
private int age = 0;
private bool modified = false;
public string Name
{
set{ this.name = value;
this.modified = true;
}
get{ return this.name; }
}
public bool Modified
{
get{ return this.modified; }
}
public bool SaveYourSelf()
{
if(
{
this.modified = false;
}
}
}
public class AnotherClass
{
public void checkPersonModified()
{
if (p.Modified)
{
}
}
}
I personally think that in this case, which is a case that occurs not only in very rare programms is the one where using properties does make sense. Correct me if im wrong, but that was the thing i wanted to Point out quoting _Q12_ in his answer where he stated that this is a rare case.
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Global variables/global properties, whatever you choose to use, are generally a poor idea. Now, I know that OOP principles can become almost religious dogma, but it really is a good idea to promote loose coupling and single responsibility. With global variables, you have put strong coupling into place, and it makes it much harder reuse code in other applications because now you have to copy two things around - at least one of which is going to contain cruft that you don't need in your new project.
If your argument against fields is that typing the extra get/set is a burden then you shouldn't be in this game because that's just lazy.
|
|
|
|
|
_Q12_ wrote: I knew your brother, Sherlock.
Actually you didn't - read the book "The Moon is a Harsh Mistress" and you will understand the reference and if you don't I can get Manny to come and belt you with his left arm or simply drop a rock on you!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
That's it, but it's not very elegant. You can use properties to return the value of visual objects. Like so. There is no reason to create that form and leave it in memory. It better to use it and then destroy it as soon as you're done.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
using (Form2 f2 = new Form2())
{
f2.ShowDialog();
label1.Text = f2.TextValue;
}
}
}
public partial class Form2 : Form
{
public string TextValue
{
get { return textBox1.Text; }
set { textBox1.Text = value; }
}
public string LabelValue
{
get { return label1.Text; }
set { label1.Text = value; }
}
public Form2()
{
InitializeComponent();
}
}
|
|
|
|
|
|
There's actually an article here that shows how. Take a look here:
[Passing Data Between Forms]
If that doesn't work try using searching Google for something like: "Passing data between forms in C#"
Good luck.
=======================
Every experience in life is a lesson to be learned
A. Stevens
B.S., Computer Science
|
|
|
|
|
Well, there are several ways.
Simple way is to make property to Form1 class which set values to textbox so when button clicked, you have to set to Form1.XXX Property(You have to get Form1 class instance from From2 class) .
Other way is to use message.
You think more depthly, there are many ways.
|
|
|
|
|
I have managed to create 2007 excel by Open XML SDK 2.5 in c#. Is there any way I can create 97-2003 excel as well? It looks like Open XML doesn't support older version than 2007 office. I've been googling but couldn't find out how.
|
|
|
|
|
Member 10400691 wrote: It looks like Open XML doesn't support older version than 2007 office. That is because the older versions use proprietary file formats, not XML.
Veni, vidi, abiit domum
|
|
|
|
|
Yes. And I need to generate .xls file automatically (using Windows Service). There is this NPOI - the .NET version of POI Java project which can create .xls file https://npoi.codeplex.com/[^]
Any idea if this works with user interface free applications (e.g. services)?
|
|
|
|
|
Sorry, I've not heard of this before. You should try the discussion forum on their website.
Veni, vidi, abiit domum
|
|
|
|
|
Hello,
How can I obtain the value from a specific node in my XML file?
For example please consider the xml structure below. How would I for instance obtain "max" and "min" values for node
<xx atty="3" attz="0"> and in case it requires a different search method I would also like to know how to obtain the value at node
<vars var0="3" var1="0">0</vars>
?
Anxious to learn how to do this
Best Regards
Tom
="1.0"="utf-8"
<data device="xx" version="1">
<node1>
<xx atty="2" attz="3">
<max>0</max>
<min>0</min>
</xx>
<xx atty="3" attz="0">
<max>0</max>
<min>0</min>
</xx>
<xx atty="3" attz="1">
<max>0</max>
<min>0</min>
</xx>
</node1>
<node2>
<vars var0="0" var1="0">0</vars>
<vars var0="1" var1="0">0</vars>
<vars var0="2" var1="0">0</vars>
<vars var0="3" var1="0">0</vars>
<vars var0="4" var1="0">0</vars>
</node2>
</data>
|
|
|
|