|
I have a project with a main form that accesses inherited forms with their appropriate .dll's. I have several that work fine. However, the latest form gives me the following error when I try to compile the main form:
" "_Form() is inaccessible due to its protection level
I understand what it is saying. I just dont see why. I am able to compile and run the inherited form separately with no problem. However, once I call it from my main form, I receive the previous error. Any help would be much appreciated. Thanks.
D
|
|
|
|
|
Is the _Form declared as protected instead of public as it should be?
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
spif,
Thanks for the quick response. However, the form is declared as public. public _Form(){}
Any other ideas? I am assuming it isn't a user control because it would give me this error when I run the application stand-alone. What could it be?
D
|
|
|
|
|
spif,
Thanks again for your help. You got me going in the right direction. The form was declared null within the protected override void dispose method. Thanks again for everything.
|
|
|
|
|
Try to write the whole namespace in front of the initialization.
ex.
System.Windows.Forms.Form f = new System.Windows.Forms.Form();
^^replace with the _Form's namespace.
There may be another Form with same name which is inaccesable (private or protected)
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
how can i import data from any access,oracle dbase to sql server
|
|
|
|
|
Using DTS.
---
b { font-weight: normal; }
|
|
|
|
|
I have to admit its an odd thread title, but it almost describes what I want to do.
Let say I have the following class
class Duck
{
public string name;
public int age;
public bool isMale;
}
I need to be able to access these class vars from strings. Lets say I have the following instance of the Duck class
Duck myDuck = new Duck();
myDuck.name = "fred";
myDuck.age = "2";
myDuck.isMale = false;
Elsewhere in the code I have the following strings, and I need to use these strings to access the member variables of the myDuck instance. I know this could be done with if/else/switch etc but I am curious to learn if there is a way to do this with less code.
string varName_DuckName = "name";
int varName_DuckAge = "age";
bool varName_duckIsMale = "isMale";
And example (ish) of what I want to do already exists in the .NET framework for the Color class where you can call:
Color.FromName("red")
So I would like to be able to do something like
bool b = (bool)myDuck.FromName("isMale")
Which is the case of the example above would set b as false
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
You are searching for reflection.
Your method could look like the following:
public class Duck {
public object FromName(string fieldName) {
this.GetType().GetField("fieldName").GetValue(this));
}
}
You can invoke about everything you want by using reflection mechanisms. Just explore the Type class and the System.Reflection namespace.
|
|
|
|
|
Hi
i have one data set suppose X=(2,4,6,8) and calculated mean is 5 and standard deviation is 3.162. i don't hv Y value so plz tell me how can i plot graph with the help of data set, mean and SD.
|
|
|
|
|
How can I use .class files created using java in my C# application???
---------------------------------
There is no patch for ignorance
|
|
|
|
|
reverse compile it and port to J# would be one way, dont know of any other, never done it
regs,
g00fy
|
|
|
|
|
|
Iam trying to buid an online forum .(the onw which looks like this forum for example)
I want to know how to do it?
plz help me..
venkat
|
|
|
|
|
There are a couple of good open source packages available. Start by having a look at those, then decide if such a project is still worth your time. If so, you'll have some good samples to work with. Is this for a company, or a varsity project?
|
|
|
|
|
( C# 2003 ) I have two relational Tables in the DataSet. Say Parent and Child. Now the problem is when I display the dataTable in DataGrid from Parent it Keeps the + Sign with each row and on clicking that you can see the child table records related to that record. What I want is the following
display the record without plus sign and since my table has ONE TO ONE Relation so I need to display the fields from both the tables in one line like
ParentField1 , ParentField2, ChildField1,ChildField2 in one row.
I have tried to work on DataView but may be Dont know how to work on.
Can any one please guide me or refer me to any solution.
|
|
|
|
|
You have to create computed columns in the parent table:
parentTable.Columns.Add("ChildField1", typeof(int), "Max(Child(RelationName).Field1)");
ChieldField1 is the name of the new column.
The type must be set to the type of the child column.
RelationName must be the name of the relation between parent and child table.
Field1 is the name of the child column you are referring to.
The Max is needed because there COULD be several childs existing for a single parent (you could also write Min, which would have the same effect when having a 1to1 relation).
For details about using expressions in DataColumn refer to this page.
|
|
|
|
|
Hello,
I am trying to write a simple console app that reads the data contained in specific Excel spreadsheet cells, and use that data to write an .xml file with the XmlTextWriter class. when I go to compile the code, I get an error that says it does not recognise 'using Excel;' and that I may be missing a reference. The thing is I had already added the Excel reference from the Project > Add Reference.. dialog. I run into this error before when writing to an Excel worksheet and after I clicked 'Yes' to continue in the 'Build Errors' dialog, the app ran perfectly, but not this time.
I now get an error that says VS cannot start debugging beacuse the debug target <path>\Program.exe is missing. I have never seen this before, can anyone help me?
The code below is an extract on my class:
class Program
{
static void Main(string[] args)
{
//directory of XLS file to be read from
string xlsDir = "";
bool xlsError = false;
XmlTextWriter writer = new XmlTextWriter("C:\\My Documents\\test1.xml", _UnicodeEncoding);
writer.Formatting = Formatting.Indented;
int countVPS = 0; //to increment the VPSnodes array
string[] VPSnodes = new string[5] { vendorID, vendor, copyright, version, _schemaVersion };
//opens dialog to browse directories and open a file
OpenFileDialog openFile = new OpenFileDialog();
openFile.InitialDirectory = "c:\\My Documents";
openFile.Filter = "xls files (*.xls)|*.xls*|xml files (*.xml)*.xml*|
_All files (*.*)|*.*";
if (openFile.ShowDialog() == DialogResult.OK)
{
xlsDir = openFile.FileName;
Excel.Workbook wb = this.Application.Workbooks.Open(xlsDir);
// activate the active worksheet in the workbook
(Microsoft.Office.Interop.Excel._Workbook)
_this.Application.Workbooks[1]).Activate();
((Excel.Worksheet)this.Application.ActiveWorkbook.ActiveSheet);
try
{
if (ExcelObj == null)
{
Console.WriteLine("\nERROR: EXCEL couldn't be started!");
xlsError = true;
}
if (xlsError == false)
{
writer.WriteRaw("<vps>");
writer.WriteStartElement("vendorProductSet");
for (int colV = 1; colV <= 5; colV++)
{
writer.WriteAttributeString(nodes[countVPS],
_((Range)ws.Cells[2, col]).Value2);
countVPS++;
}//end VendorProductSetNode
}//end if
writer.Close();
}//end try
catch (Exception e)
{
Console.WriteLine(e);
}//end catch
}//end if
}//end main
}//end class
|
|
|
|
|
Hi,
I am storing description of few forms in a .DEF file(text file). The .Def file is in a particular format and each form description is stored under a particular heading say for Eg. FORM1, FORM2, FORM3. Now after a particular form is edited say FORM2, I will have to rewrite the entire block of text under the header FORM2 which is nothing but a string . What is the best way to rewrite a particular block of text ?
Thanks
Bharath
|
|
|
|
|
Afaik there is no straight way to do it, because unless the length of those blocks are always the same there would be the need to move everything coming after the exchanged block of text (which would mean to write the whole file again if you were exchanging the first block).
But unless you aren't talking about several thousand lines of text you should probably just write everything when needed. The performance overhead shouldn't be that much.
Another method would be to store your infos in several files (one for each form).
|
|
|
|
|
|
Yes. Its the description of XFS forms
Thanks
KR
|
|
|
|
|
I have created a custom action(windows application) and then added a setup and deployment project to install this.
I need to return custom errors when the msi is executed using MSIEXEC.exe.
Can anyone help me regarding this?
Regards,
Lata Agrawal
|
|
|
|
|
Hi
I have a problem using OleDbDataAdapter and DataSet in a C# windows application and MS Access 2000 database. The primary keys use AutoNumber/IDENTITY columns.
In the DataSet I load two tables from the database (a parent and a child table).
I add an event handler to the dataAdapter:
adapter.RowUpdated += new
OleDbRowUpdatedEventHandler(DataAdapter_OnRowUpdate);
private static void DataAdapter_OnRowUpdate(object sender, OleDbRowUpdatedEventArgs e)
{
OleDbCommand oCmd = new OleDbCommand("SELECT @@IDENTITY", e.Command.Connection);
e.Row["MachineIndex"] = oCmd.ExecuteScalar();
e.Row.AcceptChanges();
}
When I insert new data into the parent table in the DataSet and update the database the above-mentioned event handler returns the correct newly inserted AutoNumber column value. However when I update an existing row in the datatable in the DataSet and update the database, the value returned is 0 (zero) and then the index of that row in the DataSet shows 0.
Can anyone give me some assistance regarding this problem.
Thanks.
Kobus
|
|
|
|
|
The @@identity property is only set when a record is created, not when a record is updated.
---
b { font-weight: normal; }
|
|
|
|