|
Hello!
i added items in combobox from treeview.
but i have a problem in combox because; when i enter 2 or more times same text in treeview nodes,combobox is adding 2 or more times these texts, too. i want that, texts return only one time. how can i do?
thanks
|
|
|
|
|
Hi,
I developed an application that receives a lot of transactions and generates C# code to perform a dynamic execution in order to create the requested response. The C# code is generated matching the request data with several rules define by the users.
I used some profiler to find a memory leak that were happening with the app. Generating some snapshots I found memory problems with reflection.
When I executable performed the CodeDomProvider.CompileAssemblyFromSource the memory seems to be very afected, It seems that any assembly loaded into a given cannot be unloaded once it's been loaded with .NET runtime.
This kind of programming could work for few transaction per hour, but when it refers to several transaction per seconds this will be a real problem.
Is there someway to dynamically execute C# code and preserve a lightweight execution and good performance?
I was considering developed a parse/compiler because the complexity that could achive the generated source code, but First of all, I want to find out if there is something in C# that already do that?
Generated Code sample: The values of the variables are filled with the incoming transaction data.
" int x = 13, y = 3, z = 200; if ( ((x*y) > z) && (z < 200) && ( x > y) ) return 1;"
Thanks.
rmga
|
|
|
|
|
rmga wrote: It seems that any assembly loaded into a given cannot be unloaded once it's been loaded with .NET runtime
While an assembly cannot be unloaded once it is loaded into an application domain, you can create a new application domain, load the assembly into it and the unload the entire domain. I do not know the performance of this only that it can be done.
-- modified at 23:26 Friday 25th May, 2007
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Hello,
I have a COM+ application built using C# and the MSI for it runs just dandy, its basically a COM proxy for .NET to ASP. However, when running a test VBScript, I get the following message whenever I attempt to execute one of the methods (object seems to get created though)..
on this line: set objCreditAppEntity = objComProxy.GetSavedApplication(1, "CITDE")
with this message: Error retrieving certificate with ID <> from location LocalMachine
and this stack trace:
System.Configuration.ConfigurationException
Stack Trace:
at CIT.EAI.Crypto.CertificateManager.RetrieveCertificateFromStore(X509CertificateStore store, String keyIdentifier)
at CIT.EAI.Crypto.CertificateManager.GetDefaultCertificate()
at CIT.EAI.Web.Security.WseUtilities.GetClientToken()
at CIT.EAI.Web.Security.WseUtilities.ConfigureProxy(WebServicesClientProtocol protocol)
at CIT.EAI.EFCanada.ComProxy.RepositoryFactory.GetCreditAppWS()
at CIT.EAI.EFCanada.ComProxy.EFCanadaComProxy.GetSavedApplication(Int32 creditAppId, String applicationCode)
Any ideas why? seems to be a WSE thing, but I'm lost as I'm still kind of a newbie to COM, etc...This proxy talks to three web services by the way.
VBScript test code given below
----------------------------------------------
Dim objComProxy
Dim arrContact
Dim errCode
Dim objCreditAppEntity
Dim objCreditAppEntityList
Dim objQuoteEntity
Dim objQuoteEntityList
dim xmlDoc, sPath, sFile, sInFileName
Set objComProxy = CreateObject("CIT.EAI.EFCanada.ComProxy.EFCanadaComProxy")
'ERROR HERE
set objCreditAppEntity = objComProxy.GetSavedApplication(1, "CITDE")
WScript.Echo "Credit app ID: " & objCreditAppEntity.CreditAppId
WScript.Echo "Credit app status code: " & objCreditAppEntity.CreditAppStatusCd
|
|
|
|
|
I am writing an application in C#.NET. I am using .NET DataBindings in addition to direct calls to the database. My application currently uses SQL Server as the back end. I would like my application to also support MS Access as a back end. I'm having a difficult time getting the databindings to work with either SQL Server or MS Access. Any tips/advice would be greatly appreciated. Thanks
|
|
|
|
|
Hi,
I am so sorry for this question. I am sure there are a million answers to it. In fact, I found some articles on it but when I tried running them, I kept getting errors. I think they were for an older version of VS because sometimes it would try to convert them when I load them up. I have done the RSS reader training from MSDN - to give you an idea of where I am regarding my knowledge level.
Here is exactly what I want to do;
I am developing my first non-training related application. It is a simple finance application but I want the user to be able to create the database with the name and location of his choice. I have read book after book and article after article about databases in VS and almost all of them use the wizard to create the database and tables, etc. The ones that don't give me compile time errors. I want the program (under user control) to create the database at runtime. He can either click on a toolbar icon or go Menu/File/New. I can do the form related things but this database thing is kicking me around the block. I looked up create database in the msdn library help and it keeps giving me t-sql commands and scripts but the user will not have sql server installed so I can't do that. It is beyond me why this is so hard for me to find.
Ciao
bb
|
|
|
|
|
Use SQL Server Express instead of Access. It's free and you can use the SQL commands you have read about.
only two letters away from being an asset
|
|
|
|
|
um..ok but how do I do that. Like I said, when I tried the examples I have seen like this one (http://www.codeproject.com/cs/database/DBInstaller1.asp), I kept getting errors.
|
|
|
|
|
Perhaps you would care to elaborate and tell us what errors. "I kept getting errors" isn't very helpful. How would you solve a problem with level of information?
only two letters away from being an asset
|
|
|
|
|
Firstly, regarding the errors related to loading up the sample I referenced in my last post, they arise from the Visual Studio Conversion Wizard. It does not specify the errors other than saying that there was a conversion error with banner.jpg
Secondly, I think I gave enough information in my original post. If you didn't read it, I will repeat it.
I am developing my first non-training related application. It is a simple finance application but I want the user to be able to create the database with the name and location of his choice. I have read book after book and article after article about databases in VS and almost all of them use the wizard to create the database and tables, etc. I want the program (under user control) to create the database at runtime. He can either click on a toolbar icon or go Menu/File/New.
If someone knows the answer, I would appreciate a proper reply - preferably with a snippet of sample code.
|
|
|
|
|
First issue. Contact the author if you havne't done so already.
Second issue. Be specific. What have you tried? What are the issues you are having?
brickbat wrote: If someone knows the answer, I would appreciate a proper reply
Proper reply? It took three posts for you mention the errors were from the conversion wizard and not code related. If you want a "proper" reply, then provide the details necessary for us to help you.
brickbat wrote: preferably with a snippet of sample code.
I find it difficult to believe that after reading all the references you say, you did not find any example of a sql statement to CREATE DATABASE.
only two letters away from being an asset
|
|
|
|
|
You are right. I did find several references to it and I can't get them to work. Here is where I got.
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace Project<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
toolStripStatusLabel1.Text = "";<br />
}<br />
public void NewStatus()<br />
{<br />
<br />
}<br />
public void CreateDatabase()<br />
{<br />
string sCreateDatabase = "CREATE DATABASE Projectdb9"; <br />
SqlConnection mycon = new SqlConnection();<br />
mycon.ConnectionString = "Data Source=.\\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;User Instance=True";<br />
<br />
SqlCommand mycomm = new SqlCommand();<br />
mycomm.CommandType = CommandType.Text;<br />
mycomm.CommandText = sCreateDatabase;<br />
mycomm.Connection = mycon;<br />
<br />
try<br />
{<br />
mycon.Open();<br />
mycomm.ExecuteNonQuery();<br />
}<br />
catch<br />
{<br />
toolStripStatusLabel1.Text = "Database Creation Error ";<br />
}<br />
finally<br />
{<br />
mycon.Close();<br />
}<br />
<br />
}<br />
<br />
private void newToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
CreateDatabase();<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
<br />
} <br />
}<br />
}<br />
But I know its wrong. Firstly, I can't figure out where to set the path. In all the references I found, I can't find anything about setting the path so I think I am creating an SQL database on an SQL server which is NOT what I want. Thats why I didn't post my code straight away. I would rather get a simple answer to my question instead of people being confused about what I want by my code and fixing it but still leaving me with the wrong solution.
n instead of people being confused about what I want by my code and fixing it but still leaving me with the wrong solution.
|
|
|
|
|
Thankfully someone at the MSDN network pointed me in the right direction. For those that might have the same problem, here is the answer.
http://support.microsoft.com/default.aspx/kb/317881
As I thought, unless you want the user installing an SQL server on his machine, the best course is to use an access database.
Here is some code
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using ADOX;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace Project<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
toolStripStatusLabel1.Text = "";<br />
}<br />
public void NewStatus()<br />
{<br />
<br />
}<br />
public void CreateDatabase()<br />
{<br />
<br />
ADOX.CatalogClass cat = new ADOX.CatalogClass();<br />
<br />
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" +<br />
"Data Source=D:\\Projectdb.mdb;" +<br />
"Jet OLEDB:Engine Type=5");<br />
<br />
toolStripStatusLabel1.Text = "Database Created Successfully";<br />
<br />
cat = null;<br />
<br />
<br />
<br />
}<br />
<br />
private void newToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
CreateDatabase();<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
<br />
} <br />
}<br />
}<br />
As you can see, there is a place for the path and now I just need to add a little code to get the name and location selection from the user and its done. Well, there is the adding of tables,keys,etc to be done too.
|
|
|
|
|
As I stated orginially Access is not the best choice. Using SQL Server Express provides for better scalablity and functionality, easier programming model, etc., not to mention that the code you posted previously would have worked, without this long thread and all your self-imposed problems.
only two letters away from being an asset
|
|
|
|
|
You have not given one piece of usable advice. Are you a troll?
- You say "Use sql" but when I ask how, you give no examples and you ask me for what I have tried.
- When I ask how to specify the path for the database, you ignore it.
- When I post my erroneous code, you say it works.
Useless, Useless, Useless.
|
|
|
|
|
brickbat wrote: Are you a troll?
Trolls aren't given MVPs....
brickbat wrote: You have not given one piece of usable advice.
He has. I'll add, use SQL Express instead of Access...
|
|
|
|
|
brickbat wrote: Data Source=.\\SQLEXPRESS
This is the path. It is the local instance of SQL Server Express that has been installed on the system the applicaiton is running on. You could also use something like Data Source=MyDB.mdf for a file based database for the application.
Again, with all of the refences you have claimed to have read I find it difficult to believe this has not been explained.
only two letters away from being an asset
|
|
|
|
|
|
To the trolls, MVP or not - Thanks for no help. Here is correctly working code for those that might be interested. Obviously, the Server location, the database and logfile paths, and the size parameters may need to be changed to suit the application. I will not be using this because as I thought, you need to have an sql server running for this to work. I will not require my users to have an sql server constantly running because of a small finance application which they may use once per month.
Here is correctly working code
<br />
String str;<br />
SqlConnection myConn = new SqlConnection("Server=local\\SQLEXPRESS;Integrated security=SSPI;database=master");<br />
<br />
str = "CREATE DATABASE MyDatabase ON PRIMARY " +<br />
"(NAME = MyDatabase_Data, " +<br />
"FILENAME = 'E:\\MyDatabaseData2.mdf', " +<br />
"SIZE = 2MB, MAXSIZE = 10MB, FILEGROWTH = 10%) " +<br />
"LOG ON (NAME = MyDatabase_Log, " +<br />
"FILENAME = 'E:\\MyDatabaseLog2.ldf', " +<br />
"SIZE = 1MB, " +<br />
"MAXSIZE = 5MB, " +<br />
"FILEGROWTH = 10%)";<br />
<br />
SqlCommand myCommand = new SqlCommand(str, myConn);<br />
try<br />
{<br />
myConn.Open();<br />
myCommand.ExecuteNonQuery();<br />
}<br />
catch (System.Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString(), "MyProgram", MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
}<br />
finally<br />
{<br />
if (myConn.State == ConnectionState.Open)<br />
{<br />
myConn.Close();<br />
}<br />
}<br />
|
|
|
|
|
Mark Nischalke wrote: You could also use something like Data Source=MyDB.mdf for a file based database for the application.
Again, with all of the refences you have claimed to have read I find it difficult to believe this has not been explained.
WRONG. WRONG. WRONG. Your signature is very appropriate. For people really interested in how this works, check my other post to see actually working code.
|
|
|
|
|
Hello everyone,
I have a Windows Application with a Button which can have various Images. As the image in the Button changes, I would like to create the illusion of appearing slowly rather than just popping up.
I am wondering if it is possible to change the transparency of an image displayed in a button programaticly?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
Hello,
Maybe you can work with a little trick here,
The System.Windows.Forms.Form has a property called Opacity (0% to 100%).
If you create a Form and display it over your form with opacity = 0.0 (0%).
Than setup a timer with low intervall (50ms for example).
On the timer tick you increase the opacity +0.1;
If the opacity is 1.0(100%) you can change the Image and start decreasing the opacity again till it is 0.0.
I'm sure there is a much cleaner solution.
Maybe if you inherit YourButton from Forms.Button and handle the OnPaint event.
In that you can do you painting like you whant!
Hope it helps!
All the best,
Martin.
|
|
|
|
|
Ok, I just figured out a solution for ya. You'll have to override the OnPaint to use it, of course. To see the effects, set the button's BackgroundImage to some arbitrary picture (Just for testing), then set an IMAGEPATH const to the pic to draw...
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
System.Drawing.Imaging.ImageAttributes attr = new System.Drawing.Imaging.ImageAttributes();
System.Drawing.Imaging.ColorMatrix matrix = new System.Drawing.Imaging.ColorMatrix();
matrix[3, 3] = 0.2F;
attr.SetColorMatrix(matrix);
Image img = Image.FromFile(IMAGEPATH);
e.Graphics.DrawImage(img, ClientRectangle, 0F, 0F, img.Width, img.Height, GraphicsUnit.Pixel, attr);
}
Quick explanation...
I don't know how familiar you are with transformation matrices, but graphics operations generally work with 4x4 matrices for 3D position transformations and 3D color transformations. In the case of a color one, the four rows/columns stand for R, G, B, and Alpha (Opacity).
The default matrix is an identity matrix:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
And this is equivalent to multiplying each component by 1. We're changing element [3,3], the last 1, into a 0.2. This leaves R, G, and B alone, but multiplies the Alpha component by 20% before outputting it.
(Obviously, change 0.2 to any value from 0=Transparent to 1=Opaque)
|
|
|
|
|
Hi!
I want to send a SMS with an UMTS/HSDPA modem (HUAWEI Model: E220) in my C# application.
This moden is from the austrian provider T-Mobile and you can send with the attached application SMS.
Any ideas?
regards
spotl
|
|
|
|
|
First time to pose a question on this board...fairly new to C# too, so please go easy
I want to do something like this in Generics:
List<int, String[]> myList = new List<int, String[]>();
This blows up obviously...any workarounds? Thanks!
Mikeyyy
|
|
|
|
|