|
Hi,
I have a small problem with my solution/references.
I have 2 projects in the solution. I use a folder(in the solution) where are some cs files. I need in one cs file use System.Managemet.
I know that exist references folder in a project, but these file is in the solution. There isn't any references folder.
How can I do that? Is it possible to have any reference inside a cs file?
Thanks.
|
|
|
|
|
I don't understand your question. You don't need explicitly add a reference to your project to use the classes in the System.Management namespace. They're available by default.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
when i want to use System.Managemet, have to add reference. Without reference it doesn't work.
|
|
|
|
|
I'm not sure why have to explicitly add a reference to System.Management to use it. But if it works then there's no problem, right?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I am so stupid. I have been looking for asolution a couple of hours.
I just added reference into both projects and it works.
Thanks.
|
|
|
|
|
i know flash media server offers the functionality of multi-person video chat, live broadcasting,
does microsoft also has a server like that?
thanks
|
|
|
|
|
Hi,
I use "microsoft access" file (mdb) as a local database.
I have no problem reading the data from it and show it on the DataGrid. the problem is when i want to delete a row i get Exceptions like:
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: Update requires a valid DeleteCommand when passed DataRow collection with deleted rows."
Well , this is my code. can someone tell me what im doing wrong ?
Thanx
----------------------------------------------------------------------
dsDB.Tables["Clients"].Rows[1].Delete();
ClientsAdapter.Update(dt);
----------------------------------------------------------------------
dsDb is my DataSet.
ClientsAdapter is my DataAdapter.
as i wrote above, i can see the data from the database on my datagrid so i assume that there is no problems with the object i use.
|
|
|
|
|
In order for your code to work you must set the ClientsAdapter.DeleteCommand property.
|
|
|
|
|
can you be more specific ?
what should i set?
|
|
|
|
|
ClientsAdapter.DeleteCommand property
|
|
|
|
|
I'm new to C#,but I used VB.NET a lot ... This prject I have to do in C# and I allready have problems connecting to my SQL SERVER Database.
I put an combobox into my form which I want to link to some records in my database ...
So combobox.Datasource = ... Add Project DataSource ... Database ... Connection to my SQL SERVER Database ...
I saved the connection string as TSConnectionString ... Selected the tables and views I need from my database ...
and Visual Studio has created the files ... TSDataSet.xsd ( TSDataSet.Designer.cs , TSDataSet.xsc , TSDataSet.xss )
I mention that the combobox.DataSource property is still empty and the program can compile succesfully ... for now
When I come back to fill combobox.Datasource with TSDataSet namely tSDataSetBindingSource when i try to compile the
next error message pops up :
Error 1 The type name 'TSDataSet' does not exist in the type 'TSales.TSales'
... and the code behind this error is :
this.tSDataSet = new TSales.TSDataSet(); --------------- here is the error
this.tSDataSetBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panTop.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tSDataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tSDataSetBindingSource)).BeginInit();
this.SuspendLayout();
Remember though I wrote above that Visual Studio creates those 4 files (TSDataSet.xsd , TSDataSet.Designer.cs , TSDataSet.xsc , TSDataSet.xss ) and puts them in Solution Explorer
So my question is ... how come there is no tSales.TSDataSet ?
and what should I do to link those records to that combobox and other records to other controls in my form
Thank you
|
|
|
|
|
hello everybody....
I want to know How to enable/disable an item in an checkboxlist ?
i need that urgent.
I follow below procedure.
CheckBoxList.item[0]. ===I did not get enabled option .how to get that enable option.
thanks
|
|
|
|
|
|
CheckBoxList.SetItemChecked(0, true);
hope it will help
Becoming Programmer...
|
|
|
|
|
Hi,
I have a datagridview with a checkbox column and multiselect set to true. I want the user to be able to select multiple rows and check/uncheck them with a single click on one of the selected checkboxes. (like you can set the status flag for multiple emails in outlook). But unfortunately when you click on a checkbox only the row this checkbox is in becomes selected destroying the current selection.
Is there a way to keep the selection?
Cheers
Andreas
|
|
|
|
|
Hi everyone
I'm still quite new to Object Oriented Programming, so please forgive me for this newbie question.
I'm building an application with a main form and a couple of sub-forms. There is also an assocated service that goes with the application.
- Should the class library only code that doesn't deal directly with processing events on the forms, or just methods that are used more than once?
- Should each form then have its own class library, or should I create a single class library for the whole application and the service to use?
- Or should I be creating separate class libraries based on their usage to enable later reuse of the class library?
I've trawled through MSDN and found some best practices but they don't mention what to do in the above scenarios... I gotta say I'm leaning towards the last point here, but I really don't know...
Any help you gurus can provide would be greatly appreciated!
Cheers
Paul
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
Poolee wrote: Or should I be creating separate class libraries based on their usage to enable later reuse of the class library?
Bingo!
/ravi
|
|
|
|
|
Ok, thanks Ravi.
But what about methods purely related to doing something related to the form, but doesn't fall into a particular category? Should I be keeping those with the form class's code?
Cheers
Paul
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
Yes. If you think the methods could be used by more than one form, you may want to encapsulate them in a utility class.
/ravi
|
|
|
|
|
Awesome, thanks for your help Ravi!!
Cheers
Paul
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
Hello,
I have a doubt in Inheritance. Can you help me?
I have a baseclass "common" with 3 child classes child1,child2,child3
I have another base class "state" with its 3 child classes state1, state2, state3.
I have a function named xyz() in all the 3 childclasses of "common", which I want to move to the parent class common.
The function xyz( ) in child1 uses the class state1 inside the function, creates object for state1.
The function xyz( ) in child2 uses the class state2 and creates object for state2.
The function xyz( ) in child3 uses the class state3 and creates object for state3.
The function xyz() is same, that is, repeated in all of the 3 childclasses, the only difference is usage of classes state1, state2, state3.
In this case how can I move this xyz() function into the base class "common", so that all the 3 child classes can access the function from the parent class...
I am unable to receive state1, state2 or state3 selectively as argument for the function xyz() at the baseclass "common", depending upon which child class (child1,child or child3) calls this function. Passing the baseclass "state" in place of state1, state2, state3 does not work as the child classes contain additionaly required variables not present in "state".
Is it necessary that I have to use Generic Inheritance....
can throw some light on it?
with best regards
Karthik
|
|
|
|
|
Hello everybody .... any help with my question? ... Thanks in advance.
Karthik
|
|
|
|
|
I almost didn't answer you because at first glance, I thought you had an answer already. Help on this site is free. Especially on weekends, it's not always fast, it can be, but you just need to wait, so long as your question is visible, this sort of post doesn't really help.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am having trouble folloowing this.
I *think* what you need to do is write code in the base class like this:
class common
{
public void xyz(state s)
}
then in your derived classes do this:
class child1
{
public override void xyz(state s)
{
state1 state = s as state1;
if (state != null)
{
// interact with it
}
else
{
// do whatever you want when the state is not the type you hoped for
}
}
}
Having a pair of class heirarchies that are so tightly coupled makes me wonder if the state should be a property of the base class, instantiated as the right type in the derived class, and accessed from the childx class.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Dear Mr. Graus,
Thanks for ur reply. Actually, the function xyz() is presently located in the three child classes child1, child2 & child3 and working alright. What I want to do is, to move this xyz() function into the base class "common", so that all the 3 child classes can access the function from the baseclass.
When I have physically moved the function xyz() to the "common" baseclass, the child classes child1, child2 & child3 would have no problem calling this function in the baseclass and pass the appropriate class (that is, one of state1, state2 or state3) as argument, depending on who is calling the function. But the problem arises when I try to create the objects of the class state1 or state2 or state3 inside the xyz() function in the baseclass.
for example, If I create object for state1 inside the Function, it will work only for state1 but will not work for state2 or state3 as arguments, called from child2 or child3 respectively. How can I write a code in the baseclass that accepts any one of state1, state2 or state3 as arguments?
Thanks for your reply and help.
Greetings,
Karthik
|
|
|
|