|
I used a 3 layer method. I have the database, a special class I designed to do the Read,Insert,Update,Remove things for me. And the user part.
This works fine for me. Ok, I have 40.000 lines of code at the moment. But the application is fast, has a lot of features and zero errors. (At least the users say so )
But you can also use plain and simple: the data adapters and datasets from the .NET Framework. Less code to write, but it uses up more memory then probably needed.
Greetings....
|
|
|
|
|
Does anybody know anything about C# applets?
What restrictions implies, if any?
Sergiu.
|
|
|
|
|
??
I didn't know there were C# applets?
Greetings....
|
|
|
|
|
I don't think there are C# applets in the same way there are Java applets
However you should be able to issue C# applications as ActiveX controls if the client system has the .NET Runtime installed. Simply register the application for com interopt and host it on a web page.
I've never tried this or heard of it being done but I've also never looked into the issue.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
You dont need to make an activeX, just make a control library .dll file with
a class extending the Control class.
It is strange that microsoft didnt tell anything about it. You can search
for yourself in msdn.
Sergiu.
|
|
|
|
|
In VB.Net this late binding works fine
Dim Version As Integer
Dim Revision As Integer
Dim Wnum As Integer
Dim o As System.Array = System.Array.CreateInstance(GetType(Single), 1)
Dim h As System.Array = System.Array.CreateInstance(GetType(Single), 1)
Dim l As System.Array = System.Array.CreateInstance(GetType(Single), 1)
Dim c As System.Array = System.Array.CreateInstance(GetType(Single), 1)
Dim Vol As System.Array = System.Array.CreateInstance(GetType(Int32), 1)
Dim Dates As System.Array = System.Array.CreateInstance(GetType(Int32), 1)
t = CreateObject("TC2000Dev.cTC2000")
Wnum = 1000
Revision = t.GetRevision
Label1.Text() = Revision
t.GetPrices(Wnum, o, h, l, c, Vol, Dates, 100)
Label2.Text() = c(1)
When it is converted to C# late binding, the GetRevision method works but the GetPrices does not
GetRevision only is suppose to return an Int32, but GetPrices is supposed to return multiple System.Arrays
int WNum = 1000;
System.Array _open = new System.Single[1];
System.Array _high = new System.Single[1];
System.Array _low = new System.Single[1];
System.Array _close = new System.Single[1];
System.Array _vol = new System.Int32[1];
System.Array _date = new System.Int32[1];
object[] d = {WNum, _open, _high, _low, _close, _vol, _date, day};
Type myType = Type.GetTypeFromProgID("TC2000Dev.cTC2000");
object myObject = Activator.CreateInstance(myType);
//Works
Int32 Revision = (Int32) myType.InvokeMember("GetRevision",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{});
label1.Text = Revision.ToString();
//Does not work
d = (object[]) myType.InvokeMember("GetPrices",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{WNum, _open, _high, _low, _close, _vol, _date, 100});
How does the InvokeMember need to change to allow the GetPrices to work?
WNum and 100 are the input params, and _open, _high, _low, _close, _vol, _date are system arrays that are returned
Thanks
|
|
|
|
|
I am allowing image editing in my application. I can modify the gamma setting, but am having a difficult time modifying the brightness and contrast of the image.
I have checked the imaging.members area and could not find anything the remotely sounds like what i need.
Any suggesstions
THanks
James
|
|
|
|
|
Using C# and .NET, I am able to write most data to a database.
I do this by creating a new row in the dataset, setting the column
values, and then using the data adapter's Update method on the dataset with the new row.
This works fine until I try to do an update with an array object in one of the rows.
When I designed this particular table, the row I want to accept the array is
of SQL_Variant type. When the new row is created, it is a System.Object.
The row accepts the System.Array I put in there.
But the Update() throws an exception of unspecified error.
Any idea how I can accomplish getting my fixed array into the
database?
Thanks!
|
|
|
|
|
It is an array of what?
It really sounds like you want to create a new table and put a row for each element of the array.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
|
|
|
|
|
Ok, I'll try to make this as short as possible. I have wrote a C# app that creates static HTML pages. One of the pieces for each page is obviously the keyword meta tags. To thicken the plot, this same program generates the same pages for different sites. But different keywords for each site. What I'm trying to accomplish is to have an external XML file that basically "defines" what the keywords are for each site.
My question is this, what if I want to change say the Persons name for each of my pages, but using the same keywords. Example: Visit Bob Smith's Home Page
My Application is going to have the name Bob Smith defined, so basically when I import my XML it needs to have a place for a variable. So the XML file should read Example "Visit" + theName + " Home Page". So when it comes into my app + theName + get's defined as Bob Smith's.
Obviously it doesn't work this way and I need it to. Any ideas. Hope I haven't confused the hell out of everyone
-Brent
|
|
|
|
|
Hi Brent,
It sounds almost like you want to add meta tags to your meta files. Actually, it's not uncommon to have a file template that is pre-processed in order to feed it to the appropriate consumer.
A classic example is the pre-processor .h files used by C/C++ compilers. However, in your case, you want to take existing XML files and use them directly with text replacement. Probably not very easy to do with the XML parser directly, but perhaps you can consider this:
Create your own "XML template" with a different file extension; allow a certain delimiter to define 'tags' in the XML file which don't clash with the XML syntax. Create a component which can take a collection of name-value pairs, and the name of your file to read the file, parse out the 'tags', and replace the name of the tag with the value in the collection (with the tag name as the key). The resulting text replacement is then the new "dynamic XML" that you can then feed to your application.
There are probably other ways of doing such with XSL, but that's one realm I've not yet trodden.
Regards,
Joe
|
|
|
|
|
Hi Joe,
Yea, that's exactly what I ended up doing. I defined variables in my XML file with @FirstName@ @LastName@ etc. and then just look for those values once I import the XML....works pretty damn nicely. Like you said, probably a better way, but I'm only dealing with about 6 variables at any one given time so it works
Thanks for the response though!!
-Brent
|
|
|
|
|
Hi there,
No problem, actually, I've used that approach in the past on other project. It does work nicely and the best thing about it is that it's configurable after you've written the code that uses it. (You just have to make sure you don't break what you feed the code!)
It's a good way of branding Web sites, nice to see someone out there thinking that way.
Regards,
Joe
|
|
|
|
|
I am somewhat new to C# and I need to create an app.config file for my application. Does VS.NET automatically create this file and if so, where can I find it? If it doesn't, how would I create the app.config file to use with my program?
Thanks!
|
|
|
|
|
VS.NET should create one for you. If there isn't one you can add right-click on your project in the Solution Explorer and select "Add New Item..." from the menu. In the list of templates you will find (if you scroll to the end) an "Application Configuration File" entry. Accept the name app.config and let it add it to your project.
Remember, and this can be the confusing bit, that your app.config file will be copied to the output directory when you build the project. The copy will be called project_name.exe.config
I hope this helps,
Colin.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
|
|
|
|
|
Hello all
I have solved the problem that I am looking for an answer on, the problem is that my solution isnt very elegant (IMHO) and I was wondering if there was a better way of achieving the effect I am after.
I have a simple XML file in the following format
<?xml version="1.0" encoding="utf-8" ?>
<report_layout xmlns="http://tempuri.org/layout_schema.xsd">
<field>
<type>label</type>
<value>Title Text</value>
<posX>5</posX>
<posY>5</posY>
<width>200</width>
<height>10</height>
</field>
<field>
<type>label</type>
<value>A Value :</value>
<posX>5</posX>
<posY>20</posY>
<width>200</width>
<height>10</height>
</field>
<field>
<type>label</type>
<value>Text Value</value>
<posX>210</posX>
<posY>20</posY>
<width>200</width>
<height>10</height>
</field>
</report_layout>
I have a piece of code that parses through this and reads out the values of the elements within <field>, but I am having to use lots of xml.Read() commands to move through the file, is there a way to go to an element gets its value and move to the next?
while(xtr.Read())
{
if(xtr.NodeType == XmlNodeType.Element)
{
if (xtr.Name == "type")
{
FormComponent fc = new FormComponent();
xtr.Read();
fc.type = xtr.Value;
xtr.Read();xtr.Read();xtr.Read();
fc.value = xtr.Value;
xtr.Read();xtr.Read();xtr.Read();
fc.posX = Convert.ToInt32(xtr.Value);
xtr.Read();xtr.Read();xtr.Read();
fc.posY = Convert.ToInt32(xtr.Value);
xtr.Read();xtr.Read();xtr.Read();
fc.width = Convert.ToInt32(xtr.Value);
xtr.Read();xtr.Read();xtr.Read();
fc.height = Convert.ToInt32(xtr.Value);
fc.PrintComponent(lboxXMLValues);
this.Controls.Add((Control)fc.CreateComponent());
}
}
}
post.mode = signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
XPathDocument doc = new XPathDocument("filename.xml");<br />
XPathNavigator nav = doc.CreateNavigator();<br />
XPathNodeIterator it = nav.Select("/field");<br />
while(it.MoveNext())<br />
{}
Mazy
No sig. available now.
|
|
|
|
|
Is there a particular reason you are not just loading the xml into a DataSet? DataSet.ReadXml then you can directly objects to the fields etc..
|
|
|
|
|
The only reason is simply that I didnt know it was possible
But now you have mentioned it, that sounds like an excellent idea, as I know my way round a dataset much better than I do XML
But also thanks to Mazdak as I also like the suggestion he made, as it forces me to learn something new about C# rather than use what i already know as a crutch.
post.mode = signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Hallo, I have a strange problem:
I can add an Excel reference, but I can't add an Access reference, I get the following error:
" A reference to 'MS Access 10.0 Object Library' could not be added. Converting the type library to a .NET assembly failed. A dependent type library 'OWC10' could not be convertedt to a .NET assembly. A dependent type library 'ADODB' could not be converted to a .NET assembly. Item has already been added. Key in dictionary: "C:\windows\assembly\gac\adodb\7.0.3300.0_.... etc\adodb.dll" Key being added: "C:\windows\assembly\gac\adodb\7.0.3300.0_.... etc\adodb.dll".
I'm using winxp and officexp. I'm also using vsnet, not the 2003 version.
Thank you
|
|
|
|
|
A better way is to download the Office Primary Interop Assemblies (PIAs) created by Microsoft themselves. These contain everything you'll need and are already converted to assemblies and signed by Microsoft.
In the future, always try to find existing PIAs from the unmanaged code publisher themselves before making your own. MSHTML (what the WebBrowser control / IE uses to parse and render) already has one, for instance, that is installed with VS.NET: Microsoft.MSHTML.dll.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have a RichTextBox control with many lines of word-wrapped text. I'm having difficulty finding out which line of text the selection caret is on.
For example
|--------|
|blah asd
|dsadea
|blah
|--------|
That RichTextBox drawing has 3 lines of word-wrapped text. Sadly, RichTextBox.Lines tells me there is only 1 line because it defines "lines" as being seperated by a new line character, not seperated by word-wrapping.
Anyone know how to determine if the caret is on the last line?
The graveyards are filled with indispensible men.
|
|
|
|
|
I use the HACK to denote "the following code is a hack to work around some unexpected behavior." Especially where using components, it often turns out that the HACK was neccessitated by a bug that the component vendor may correct or Microsoft might change in future versions of the Framework.
What do you use the HACK task for?
|
|
|
|
|
Hi,
I usually use the HACK task in the event that I need to employ a quick solution to a problem that may (or if not maintained) require a more well-thought out solution to a problem that had to be immediately addressed.
The interesting thing about those types of additions are that they usually evoke thought as to what caused the problem and make one wonder if other parts of the code suffer from the same.
Regards,
Joe
|
|
|
|
|
I use HACK as a variant on TODO. I use TODO if I know that the solution can be quickly developed and just needs my time to do it. I use HACK if I know I need a solution but the code may be complex and may need to prototyped.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|