|
Hey,
I want to create a non-visual control (for example like the Timer control). I mean such a control which will not have the behavior of a container but rather be behavior to dock to the "control tray" (as the Timer does) if I drop it to a form. If I just derive my class from System.Windows.Forms.Control, it will be a normal visual control. Can anybody give me a hint, how to develop a non-visual control? Thanks a lot.
Best regards,
Tim
|
|
|
|
|
Derive from System.ComponentModel.Component.
|
|
|
|
|
Hey,
thanks a lot!!!
Regards,
Tim
Best regards,
Tim
|
|
|
|
|
Im making an app that works as a card game AI tester. Theres game class which pretty much does all the rule related stuff and which communicates with Player classes by calling their functions, giving them some info through parameters and these functions return the AI player's response. So there really are no events in the app and no waiting anywhere. Recently i had the idea of making a RealPlayer class which would also inherit Player class and to which game class would communicate just like to an AI player. But the realplayer would ofc have user input.
So here comes the problem:
ive got a class, its constructor creates a form. functions of this class, when called, should wait for user to input something on the form (press a button for example) and then perhaps make quick calculations and return a value. How to make code wait for an event?
(and i know about event handling but thts not really the case here, if i did that id have to rewrite all game class and put events everywhere and im wondering if perhaps theres a way around that)
|
|
|
|
|
bluefl4me wrote: and i know about event handling but thts not really the case here
Yes, it is. The code you want to run, needs to be in the event. At best, a flag needs to tell you that you are waiting, and be reset in the event.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
And how do I wait for the flag to change?
|
|
|
|
|
For example:
I have a wepage with
Input text field named 'A' where a number is entered
and a submit button.
On clicking the submit button action="foo.php" , the server returns 2 multiplied to the number entered in the textfield.
How can we automate this process?
i.e. can you please guide me in writing a C# code by which I can automatically send 100 requests to the server and get results(at least..the sending part)?
Please help.
Thankyou.
|
|
|
|
|
Use the HttpWebRequest class to send a request for "foo.php" with the same method as the form (usually POST), and the form data as text, e.g. "A=42".
---
single minded; short sighted; long gone;
|
|
|
|
|
how can we consult, access, manipulate and add meta data in c# ?
|
|
|
|
|
MetaData for what? The way you access metadata is different for different types of content. For instance, you use Reflection to access the properties of an assembly.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
In fact, we have an application developped with J2EE and I must develop an application with C# that does the same fonctionnalities.
the J2EE application uses the meta data to do some treatments and also add other meta data to the program (additional informations about classes needed for the development).
So, i'm searching some documents that explain how to access to the meta data of c# classes , how to manipulate them, and also how to add new meta data specific to my application.
If you know some documents, sites or refernces, please reply me, I will be very grateful.
thank you!
|
|
|
|
|
You need to google for reflection and c#. To give you a taster, suppose that you have a class called MyClass and that you want to know what the properties are, you can do the following:
Type classInfo = typeof(MyClass);
PropertyInfo[] pinfo = classInfo.GetProperties();
foreach (PropertyInfo pi in pinfo)
{
Console.WriteLine(pinfo.Name);
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Greetings,
I'm working on a web application with a dynamically creation of a gridview and within this gridview a dropdownlist (ddl) for data validation;
Everything needs to be programmed dynamically in c# code.
The creation of the grid + data is very easy, but on 1 field I want a ddl, so that people can only choose from certain data in this ddl.
//GridView GridView2 = new GridView();
GridView2.ID = "Ellende";
GridView2.AutoGenerateColumns = false;
//GridView1.DataKeyNames = new string[] { "EmployeeID" };
GridView2.AllowPaging = true;
GridView2.AllowSorting = true;
GridView2.PageSize = 5;
BoundField bfName = new BoundField();
BoundField bf1 = new BoundField();
BoundField bf2 = new BoundField();
CommandField cf = new CommandField();
cf.ButtonType = ButtonType.Button;
cf.ShowCancelButton = true;
cf.ShowSelectButton = true;
bf1.DataField = "Task1";
bf1.HeaderText = "Task1";
TemplateField tf1 = new TemplateField();
tf1.HeaderText = "Task1";
DropDownList dl1 = new DropDownList();
dl1.DataSource = ObjectDataSource3;
dl1.DataValueField = "Recid";
dl1.DataTextField = "Status";
dl1.SelectedValue = "Task1";
GridView2.Controls.Add(dl1);
GridView2.Columns.Add(tf1);
//GridView2.Columns.Add(bf1);
bfName.HeaderText = "Employee Name";
bfName.DataField = "Name";
bfName.ReadOnly = true;
bf2.HeaderText = "Task2";
bf2.DataField = "Task2";
bf2.ReadOnly = true;
GridView2.Columns.Add(cf);
GridView2.Columns.Add(bfName);
//GridView2.Columns.Add(bf1);
GridView2.Columns.Add(bf2);
GridView2.Columns.Add(bf3);
GridView2.DataSource = DT;
GridView2.Visible = true;
GridView2.DataBind();
The main problem is that under "Task1" I need to connect the dropdownlist somehow to the gridview when using c# code dynamically.
I found out that I need a templatefield.
The gridview is filled with data when using a dataset--> that easy.
But the field with "Task1" needs to be connected with a ddl, from which a choice can be made.
When choosing a value from the ddl --> this value needs to be stored in the datatable DT.
How can I connect a DDL (with predefined data) in a gridview????
I hope somebody has an answer in c# or VB
Greetings Peter Bellen
bellenp@schneider.com
|
|
|
|
|
First off can you mention what a DDL is, as far as I know because I haven't done much web development it stands for Data Definition Language.
Secondly this might be better answered in the ASP.NET[^] or Web Development [^] forums.
|
|
|
|
|
Hi,
i want to send some emails in c#. I found some information about the smtp client class and I've implemented it. I want to use the gmail-Smtp Server. The gmail guys publicate on their page that you need a TLS encryption.
How can I use a TLS encryption in C#?
Thanks
spotl
|
|
|
|
|
There's a flag you set in the SmtpClient class, something along the lines of EnableSSL .
|
|
|
|
|
I've built a fairly simple windows service and tried installing it on my local machine via both installutil.exe as well as a setup/deployment project. Both types of installation indicate a successful install, however, the service is not listed in the list of services on my machine.
I've searched Google, etc to no avail....any tips or things I should be looking for?
Thanks a million,
Brent
|
|
|
|
|
I would guess that perhaps you are looking for the wrong name. The only other option is that installutil was not successful in installing the service. On your ServiceInstaller there is a SErviceName
ServiceInstaller.ServiceName
This must have the name of your service for it to show up.
Here is an article I wrote that has some sort code with a window service in it.
http://www.codeproject.com/dotnet/OpenFiles.asp[^]
Hope that helps.
Ben
|
|
|
|
|
i m using a hash table taking a string as a key and an arraylist object as a value .. each time the arraylist value changes for the second and further entries in the hashtable all the values of the hashtable changes according to the new entry in the arraylist i.e in the end all the different keys hav the same value pair that is the last entry in the array list y is it replacing the previous values of the hashtable arraylist once its been added to the hashtable
|
|
|
|
|
ArrayLists are reference types so by default variables are simply pointers to the same object in memory, so what you're storing is a pointer to the same array. What you want to look into is the Clone method which will return a copy of the array list, this should fix your problem.
|
|
|
|
|
Thanks A BUNCH .... u really did help me a lot thanks a lot .. i was working on it for 2 weeks thanks again
|
|
|
|
|
In solution explorer, I noticed that the Form1.Designer partial class is listed under the Form1.cs
I created some other partial class(Myclass.cs) of From1 but it doesn't appear under the Form1 in solution explorer. Is there anyway I can get it to appear under Form1.
Currently
-Form1.cs
|
----->Form1.Designer.cs
|
----->Form1.resx
...
...
MyClass.cs
Looking for
-Form1.cs
|
----->Form1.Designer.cs
|
----->Form1.resx
|
----->MyClass.cs
.....
|
|
|
|
|
Try prepending Form1 to MyClass.cs. The solution explorer tries to logically put everything together by their file name. If you write Form1.MyClass.cs, VS should see that file as a subset of your Form1 and show it in the tree as such.
|
|
|
|
|
It doesn't do that automatically, see my response to dino2094.
|
|
|
|
|
There's no way to do this automatically in VS but you can do this:
- Right click the project in the Solution Explorer and select Unload Project.
- Right click the project again in the Solution Explorer and select Edit
Project.csproj - Look for an XML element which is like
<Compile Include="MyClass.cs" /> and change it to:
<Compile Include="MyClass.cs"><DependentUpon>Form1.cs</DependentUpon></Compile> Close the project file in the editor and reload the project like in step 1, your file should now appear under the Form1 node. Note you could specify Form1.Designer.cs and it'd be displayed under that one instead.
|
|
|
|