|
Fair warning:
I am trying to learn the new .NET way of saving configuration information, and I have found that the Configuration class's Save() method does not always work, though it raises no exceptions.
When I run my app by double-clicking the .exe file, it can save its configuration. But when running under the VS2005 debugger, not only is the configuration stored in a different file (app.vshost.exe.config instead of app.exe.config), but also Config.Save() will usually fail without raising any exception. In order to be able to save the config, I have to delete app.vshost.exe.config so that my app will recreate it.
Not to be bitchy, but I do find the irony humorous.
1. We used to write text (ini) files.
2. MS told us to use the registry instead.
3. Then MS told us never to use the registry, but use text (xml) files instead.
4. They provided the .NET 1.x way of doing things, which now results in "you shouldn't be doing this" warning messages.
5. They provided the .NET 2.x way of doing things, which (oh by the way) does not work dependably, at least under the debugger.
Is there any consensus as to what is really, truly the RIGHT way to save configuration information?
--
Charles Jenkins
"The accumulation of all powers, legislative, executive, and judiciary, in the same hands...may justly be pronounced the very definition of tyranny." "If tyranny and oppression come to this land, it will be in the guise of fighting a foreign enemy."
-- James Madison, Fourth President of the United States
|
|
|
|
|
hi,
in flex grid. i set focus a cell. at this time i want to get currosor postion x,y
how can i do this
vipin paliwal
|
|
|
|
|
use Mouse Move event of data grid.
1.create two class level integer variable
private int _xGrid=0;<br />
private int _yGrid=0;
2.now in mouse move event set value of these variables
private void dataGrid_MouseMove(sende , even e)<br />
{<br />
_xGrid=e.X;<br />
_yGrid=e.Y;<br />
} 3.use these values whereever you want
|
|
|
|
|
I want to transforming some JPG-Files to one PDF-File
in my programme, How to do it?
Thank you very much!
|
|
|
|
|
Sourceforge has some free libraries, and some commerical ones exist ( and advertise on CP from time to time )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I've been using CutePDF lately, it installs as a printer and the basic version is freeware. I've been very impressed with it. I don't think it comes with an SDK though, but I haven't looked.
Russell
|
|
|
|
|
hi
i have a structure which has 3 string variable and an arraylist when i created it hasn't given any error but when i am trying to store values into the array list its giving the error like
Error cannot have instance field initializers in structs
my structure is like below
struct catalog_info
{
public string format;
public string Name;
public string connction_name;
ArrayList resourses=new ArrayList ();
}
catalog_info[] catalogs = new catalog_info[20];
|
|
|
|
|
kalaveer wrote: ArrayList resourses=new ArrayList ();
You cannot have instance field initialisers in structs. So, you can't set a default value. It's the new call that is the problem. Your arraylist is also private.
I believe you can have a constructor in a struct, set the value there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
but that initialization in the structure giving the following error
Error Field catalog_info.Name must be fully assigned before control leaves the constructor
why this error coming
please help me to avoid this error and get it work.
thanks,
kalaveer.
|
|
|
|
|
kalaveer wrote: but that initialization in the structure giving the following error
Error Field catalog_info.Name must be fully assigned before control leaves the constructor
why this error coming
Because you have to set the value of all members in the constructor. If you have no specific value for them, set them to null.
Remember that there is always a parameterless constructor for the struct, that initializes everything to 0/null.
I would suggest that you use a class instead of a struct, otherwise you can get some surprises when you start passing it around in your code. If you for example pass the struct to a method, the method will get a completely separate instance of the struct, but it still shares the same ArrayList.
---
b { font-weight: normal; }
|
|
|
|
|
Your ArrayList is default, so will be visible only within namespace (if I remember it correctly).
You should initialize the struct the same way you do it with the class. This means, you should write:
catalog_info catalogs = new catalog_info()
You can provide constructors for your struct, but not default one.
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
if i use only simple structure variable its working fine but i require structure array of 20 elements that time i got problem
so can you please tell me how to write the statement to create a structure variable with 10 elements and to call its constructor that creates my arraylist variable.
i tried like the below possible ways but none of it worked.
catalog_info [] catalogs = new catalog_info[20](10);
catalog_info [] catalogs = new catalog_info[20]();
and my structure is
struct catalog_info
{
public string format;
public string Name;
public string connction_name;
public ArrayList resourses;
public catalog_info (int i)
{
resourses=new ArrayList (i);
format = "";
Name = "";
connction_name = "";
}
}
|
|
|
|
|
You need to define 'worked'. Your code calls the default constructor, so none of your values are initialised, but it works. You could add a static method which creates your array and initialises it's members. Overall, I'd tend towards making it a class and not a struct. Anything else seems likely to be a hack.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
What about oing it this way:
catalog_info catalogs = new catalog_info(10)
Remember, struct is similar to class, not to Array.
It is value type, not a reference type, but you initialize it the same way as you do with the class
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
ListBox DataSource DisplayMember Property
Problems in C#
I have a (single select) listbox with data and
when I click on the list I can't get the right
text selected.
My listbox is setup using the DataSource property.
I set my ValueMember and DisplayMember
listBox1.ValueMember = "TypeID";
listBox1.DisplayMember = "Name";
I am able to get the "TypeID" (ValueMember) when I click on
the items.
I do that like this...
int intTest;
intTest = System.Int32.Parse(listBox1.SelectedValue.ToString ());
But I can't get the text (DisplayMember).
I have used these two ways, but...
string strDispMem;
strDispMem = listBox1.Items[index].ToString();
// the above returns... "System.Data.DataRowView"
or
strDispMem = listBox1.Text;
// The above repeats first selection the user clicks on.
Any ideas???
vipin Paliwal
|
|
|
|
|
listBox1.SelectedText ( from memory ) - it's something like that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i not understand what u say, sorry.
pls give me brif
vipin paliwal
|
|
|
|
|
try out
for(int i=0;i < listBox1.Items.Count ; i++ )
{
if(listBox1.GetSelected(i))
{
strDispMem = listBox1.GetItemText(listBox1.Items[i]);
}
}
-- modified at 7:38 Tuesday 31st October, 2006
rahul
|
|
|
|
|
Hi all
Does anybody know solution for the next problem.
I have one Windows form defined as a template and another one that inherits the template form.
In the template form I define a method for validating events (for TextBox-es).
<br />
public void Validacija(object sender, CancelEventArgs e)<br />
{<br />
}<br />
I put TextBox on inherited form and when I try to asign validating event to a TextBox (in a designer) a get an error message:
"The method 'Validacija' cannot be the method for an event because a class this class derives from already defines the method."
What am I doing wrong
Thank you !!!
|
|
|
|
|
Hasn't this got something to do with the 'override' option ?
You have to specify that the inherited method is overridable.
There are some other parameters as well along the same lines.
Good luck
Mike
|
|
|
|
|
|
CEvent in C++ is used to raise event in application and can be received in another (is that right).
What is the equivalent in C#? and is it doable to raise an event in a C++ application and receive it in C# application, and how this can be done?
Best regards
Simos
|
|
|
|
|
You could use .Net Remoting for inter process communication. Whenever you want to fire an event from process 1, call a method of process 2 by remoting and then in that process 2's method invoke an event. This will be more secure and better approach to trigger an inter process event.
Regards
Khalid
|
|
|
|
|
Hi
I have a dataset having more than 1000 rows, each row having a primary key. Is there any way can I don insertion or modification or deletion as a whole at a time? Do anybody had code for this, pls send the same. Or else give any url or suggestions also great.
Thanks in advance
Raja Raman S
Raja Raman S
Reuters India Pvt.Ltd.
Bangalore
|
|
|
|
|
u can check the datarows rowstate property of each row of table in dataset
and based on rowstate which could be added,deleted or modified u can
write appropriate queary and update the changes in database through command
object.
rahul
|
|
|
|