|
Have you tried using CreateInstance() instead?
Does this help?[^]
From msdn: The Load method of the System..::.AppDomain class can load assemblies, but is primarily used for COM interoperability. It should not be used to load assemblies into an application domain other than the application domain from which it is called.
Simon
|
|
|
|
|
Yeah, I tried that first. I couldn't make that work, either, for my exe which is in a different location.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
How about using a Settings class? Project -> Add New Item -> General -> Settings File. I think the settings are saved in a file so you could check the current version and compare against the version in the settings file.
|
|
|
|
|
There are three exes here. The updater, the installed copy of my app, and a new copy of my app. The updater needs to read the version of the other two exes.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Okay I see. But I think my idea would work. The Updater has a settings file which contains the current version of the installed app. It checks the new version and if they're not equal, do an update.
|
|
|
|
|
I'm getting this in a WinForms project (in a multiple project solution), and can't for the life of me figure out why:
Error - Program 'myapplication.exe' does not contain a static 'Main' method suitable for an entry point myapplication
I verified that the program.cs file was there, and even created a new winforms app to verify that a) the contents of both program.cs files were the same,, and b) the new winforms app would compile (the new app does, the old one doesn't).
I have no idea why I'm getting this error.
EDIT: This only happens when I compile the solution. If I compile the project by itself, it's fine.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Wednesday, April 23, 2008 7:01 AM
|
|
|
|
|
Um... at risk of inviting your wrath, is there a static void main or a form selected as the entry point in the properties ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Ummm, never mind - it was stupid programmer tricks (I was looking at the wrong sub-project).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all, i want use Active Accessibility 2.0 methods in c#.net
how can i use it?
|
|
|
|
|
hi please tll me how to recieve all file names i selected and pressed enter to open with my application
i tried command$ and commandlineargs
but this gave me just one file name with every instance of application
i want a way to get them all together in just one time
i tried startupnextinstance
it is a very slow way
my email:slcompany@maktoob.com
please help.............
|
|
|
|
|
Check this link[^].
*jaans
|
|
|
|
|
The struct in my configuration file of my program is looks like this
public struct Example1
{
public int Vendor1;
public int Vendor2;
public int vendorcount;
}
I can access it by doing this
class MyModule
{
int output = Example.Vendor1;
output = Example.Vendor2;
}
I am planning to add a vendor3 without having to modify the code (MyModule), just the configuration file which contains the struct.
I tried using
for(int x=1;x<vendorcount;x++)>
{
string argument = "Vendor" + x;
Example.argument;
}
which, for obvious reasons, doesn't compile.
Is there a way around this? In which I can just add Vendor3 on the configuration file without having to add a code in MyModule class?
NOTE: The codes have been simplified, like the loading of configuration file, and accessing it
I'd appreciate any help you can give. Thanks
|
|
|
|
|
Have you heard about arrays?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
yes, but how will I implement it by not touching any of the MyModule code? I only want to add to the configuration file, so each time I add a vendor I don't have to change the code
Can you please provide a code so that I'll know if what you're suggesting is feasible on my part?
|
|
|
|
|
Simply set the number of vendors in you configuration file and then create an array of vendors with the required size at runtime.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Is this how you're suggesting it?
public struct Example1
{
public int Vendor1;
public int Vendor2;
public int vendorcount =2;
}
class MyModule
{
int[] newint = new int[vendorcount];
for(int x=1; x<vendorcount;x++)>
{
newint[x] = Exmaple1.Vendor1; ,--- (PROBLEM) how to point to Vendor2, vendor 3
}
}
how will be able to iterate through Vendor1 to Vendor2 (to vendor3 and so forth)? If I do this I'll have to change code on the MyModule class. I need to avoid having to change the code each time I add a new vendor
|
|
|
|
|
Nope.
I mean something similar to
class Example
{
public Example(int count){ vendor = new Vendor[count];}
public Vendor[] vendor;
};
class Program
{
public static void Main()
{
Example example = new Example(vendorCount);
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I think this might work. Thanks!
|
|
|
|
|
Hi,
Any clean idea on how to load a tree-like structure "eg. nested folders" into a treeview control?? I know I have to use recursion but I dont have the guts to do it
Please, shed some light on me if you have a previous experience in such problem.
Thanks guys!
To define recursion, we must first define recursion!
(\ /)
(O.o)
(><)
|
|
|
|
|
private void Dig(string file)
{
DirFiles = Directory.GetFileSystemEntries(file);
foreach (string subFile in DirFiles)
{
FileInfo SubFi = new FileInfo(subFile);
if (!SubFi.Attributes.ToString().Contains("Directory"))
if (!listBox1.Items.Contains(subFile))
listBox1.Items.Add(subFile);
else
Dig(subFile);
}
}
I think I have the guts to do it after all
C'mon, give me five
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi,
I am trying to open a MS Access database from C# code.
I want the MSAccess database to open up on a button click.
Am able to create a connection to the database but am unable to open the database.
i want the database to be open on a button click event so that i can open a table.
Atached below is my code.Any help is welcome .
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ADOX;
using System.Data.OleDb;
using System.Runtime.InteropServices;
namespace DatabaseCreation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string strAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtdatabaseName.Text;
OleDbConnection myAccessConn = null;
try
{
myAccessConn = new OleDbConnection(strAccessConn);
myAccessConn.Open();
MessageBox.Show("Database connection is successfully Opened");
}
catch (Exception ex)
{
MessageBox.Show("Error: Failed to create a database connection. \n{0}", ex.Message);
}
if (myAccessConn.State == ConnectionState.Open)
{
myAccessConn.Close();
MessageBox.Show("Database is successfully Closed");
}
}
}
}
modified on Wednesday, April 23, 2008 5:40 AM
|
|
|
|
|
So you know in the future. If no one has responded to your question you have the ability to delete the message using the 'Delete' button in the lower right hand corner of the message.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi ,
I create a xml string using a xmldocument (c# 2.0 )
This is my code (more or less)
XmlElement MySearchNode = xmlDoc.CreateElement("MySearch");
xmlDoc.AppendChild(MySearchNode);
...
XmlNode node1 = xmlDoc.SelectSingleNode("/MySearch/Objects");
XmlAttribute nameAttrib = xmlDoc.CreateAttribute("result");
nameAttrib.Value = "012";
node1.Attributes.Append(nameAttrib);
xmlDoc.outerxml
I want to validate the xml string against a XSD :
XmlReader rdr = null;
XmlParserContext context = new XmlParserContext(null, null, "", XmlSpace.None);
XmlTextReader readerXml = new XmlTextReader(p_xml, XmlNodeType.Element, context);
XmlTextReader readerSchema = new XmlTextReader(p_xsdPath);
XmlSchema schema = new XmlSchema();
schema = XmlSchema.Read(readerSchema, new
ValidationEventHandler(Schema_ValidationEventHandler));
XmlReaderSettings ReaderSettings = new XmlReaderSettings();
ReaderSettings.ValidationType = ValidationType.Schema;
ReaderSettings.Schemas.Add(schema);
ReaderSettings.ConformanceLevel = ConformanceLevel.Fragment;
ReaderSettings.ValidationEventHandler += new
ValidationEventHandler(settings_ValidationEventHandler);
rdr = XmlReader.Create(readerXml, ReaderSettings);
this is my XSD
(a part of it)
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="MySearch">
<xs:complexType>
<xs:sequence>
<xs:element name="Objects" type="tObjects" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="result" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:complexType name="tObjects">
<xs:sequence>
<xs:element name="House" type="tHouse" minOccurs="0" maxOccurs="unbounded">
</xs:element>
<xs:element name="Garden" type="tGarden" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
....
Note : this is my xml string
<MySearch>
<Objects result = '012' >
<House>
...
</House>
</Objects>
</MySearch>
when I validate I get this error :
The 'result' attribute is not declared.
I see that validation process need :
ReaderSettings.ValidationFlags = XmlSchemaValidationFlags.AllowXmlAttributes;
and
attributeFormDefault="unqualified" .
It doesn't work !! I always get the same error ..
Could you help me ? thanks in advance .
|
|
|
|
|
I Have Return the validation expression(Alpha,Numeric,special character) in three regular expression.
How to write the multiple validation expression in single Regular Expression.
Alpha
******
Regex rx = new Regex(@"^[a-zA-Z]+$");
Numeric
*******
Regex rx1 = new Regex(@"^\d+$");
special character
*****************
Regex rx2 = new Regex("[@#$%^&*()_+=?><.,\":;~`|\\?/}{]+$");
|
|
|
|
|
I have heard that .NET framework is redistributable..
Does it mean that it is free??
If I build a client application in .NET, certainly I would need the framework, that why I want to know that can I install it in the clients system without any licensing hassles??
Are all latest frameworks free or the only the old ones? (upto 2.0) ??
|
|
|
|