|
Hello,
this.textBox1.KeyPress+=new KeyPressEventHandler(textBox5_KeyPress);<br />
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
}
All the best,
Martin
|
|
|
|
|
Hi,
I have an xml file that was exported by my function. There is 36 fields in the products table. Now a user can select which fields he/she wants to export to the xml file, below is an example of what the xml file looks like:
<Products>
<Product>
<ID>5555</ID>
<ProductName>Yellow Marker</ProductName>
<Price>4</Price>
<Status>1</Status>
<ShortDescription>Short Description</ShortDescription>
<LongDescription>Long Description</LongDescription>
</Product>
</Products>
The tag name, for example <ProductName /> is the name of the field, with the value of the field between the tags.
Now my Product class has properties for each field. I normally set my fields like this:
Product p = new Product();
p.ID = "5555";
p.ProductName = "Yellow Marker";
p.Price = 4;
p.Status = 1;
p.ShortDescription = "Short Description";
p.LongDescription = "Long Description";
etc., etc., etc...
Now I only want to populate the properties that occurs as a tag. I need to do this dynamically. How do I do this? I can do Product p = new Product(); by hard code, but how do I do p. and the name of the field together so that it is recognised as, for example p.Price?
I hope I am making sense.
Regards
ma se
|
|
|
|
|
Hello,
Looks like you are rebuilding "System.Xml.Serialization" methods. (search it here on the articles)
But to answer your question:
Reflection is what you are looking for.
All the best,
Martin
|
|
|
|
|
ma se wrote: Now a user can select which fields he/she wants to export to the xml file
How are you providing this ?
ma se wrote: Now I only want to populate the properties that occurs as a tag.
First initialze your varaibles with 0 or null or something like that check for null /0 before populating if it is null/0 means that user has not given the values of that field exclude that field.
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
hi!
i have one folder in my domain server, in that folder there are five folders in them there are thousands of files in each of them. With these, I want to create one file server. The five folders had individual users. And also I want to create user interface which will appear in client systems in a web browser. In the very first page the five folders will appear, but the particular user only can open that folder and he can download the files in that folder and also he can upload files to that folder. one user can open only his folder he cant open other folders. this user authentication will be helded on file server which is in my domain server. How can I do this? Please give me any idea to do this!
thanks in advance!
|
|
|
|
|
Hello,
I have a collection of ITask (an interface I've created) objects.
References to these objets are duplicated.
They are kept in a second collection.
This second collection is a collection of categories.
Each category can contain child categories.
Each task can appear only in one category.
This means that every single ITask object in the ITask collection is somewhere inside the categories.
I'm using this implementation to allow the user to filter the ITask objects by categories, and by other means which are not relevant.
OK... Now I want the tasks to be "restored" when the program next runs, so I serialize and deserialize them... So far so good...
I want to serialize the collection of categories the user have created, and restore them too... I can serialize the categories collection as well, but what will happen to the ITask objects when I deserialize the categories?
Will they point to the same objects deserialized to the ITask collection?
Hope this is clear enough...
If you have any other ideas regarding how to better store the collections, I'd be more than happy to hear them.
Thanks in advance,
Shy.
|
|
|
|
|
Hello,
shyagam wrote: Will they point to the same objects deserialized to the ITask collection?
No, I don't think so.
You will then have the double number of ITask objects!
I would store one Collection and additionaly the way the second collection was sorted.
After deserialization you fill the second Collection with the ITask objects of the first, and Sort it again!
All the best,
Martin
-- modified at 6:39 Wednesday 20th June, 2007
The advantage of storing the way you are sorting (with an enum for ex.), is that you are allways consistend with updated programs in combination with old datas.
|
|
|
|
|
Hello,
if you serialize the collections using 2 Serialize() calls, you would end up with duplicates of each ITask object. I would do something like this (in C#):
[Serializable]
public class DataStore
{
public ICollection Tasks;
public ICollection Categories;
}
Serializing this class will keep the references correct and will not produce duplicates.
greetings,
Enno Welbers
|
|
|
|
|
Thank you both.
Very helpful indeed...
Shy.
|
|
|
|
|
Hi folks,
I want to display a histogram with a high refresh rate. Therefore I paint the new data into a bitmap (bmpOffScreen) with graphics.draw... and copy an Image of the old data (bmpBackupScreen) into bmpOffScreen (g.drawImage()) that I use for double buffering. Than I paint the bmpOffScreen in the OnPaint function and save a copy of bmpOffScreen at bmpBackupScreen. The image is a little bit shifted to make room for the new data set.
It works fine but is flickering. I tried to implement an additionel double buffering bitmap. But it was not helpful. Do anybody knows how I supress the flicker?
Wbr,
el
|
|
|
|
|
|
hi everyone.
please I am newbie.
I am having a grid which is bound to different lookup tables,
i want to add new rows depending on the number that is captured by a user in a textbox.
eg.if the number in texbox is 4 the grid should automatically have 4 blank rows.
please help.
REgards
|
|
|
|
|
hey..
I am working on a drawing application(using openGL)
how to use trig. functions sin, cos in c-sharp etc.......the error is displayed 'Sin/cos does not exist in current context...
how to use these and other maths functions.
thanks
|
|
|
|
|
The functions are in the Math class
|
|
|
|
|
Dear All
I have a program for line drawing in C# using CSGL(OpenGL), now i want to Zoom in and out that drawing line in openGL from the menu or from the Zoom button
kindly any one help me?
Regards
David
david
|
|
|
|
|
Dear all
Regards
following is my code for zooming a triangle, but it is not working , i think some problem in GLlookAt();
----------------CODE----------------------
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
System.Drawing.Size s = Size;
width = (double)s.Width;
height = (double)s.Height;
GL.glViewport(0,0,s.Width,s.Height);
GL.glMatrixMode(GL.GL_PROJECTION);
GL.glLoadIdentity();
GL.gluPerspective(60.0, (float)s.Width / (float)s.Height, 1.0, 50.0);
GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glLoadIdentity();
}
public override void glDraw()
{
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
GL.glLoadIdentity(); // Reset The Current Modelview Matrix
GL.gluLookAt(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0);
GL.glLoadIdentity();
GL.glTranslatef(-1.5f, 0.0f, -6.0f); // Move Left 1.5 Units And Into The Screen 6.0
GL.glBegin(GL.GL_TRIANGLES); // Drawing Using Triangles
GL.glVertex3f(0.0f, 1.0f, 0.0f); // Top
GL.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left
GL.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right
GL.glEnd();
this.Refresh();
// GL.glFlush();
}
----------------------End----------------------------------------------------
kindly help me while zooming the above triangle.
waiting for your help
regards
david
david
|
|
|
|
|
Hi.
i was creating one client and server exe and used send and recive method in client and server exe.but when i press the send button , control is coming into the recieve method in server but after recieve it goes to a hang mode.control is not coming into next line in server code.why is it.
i am using same machine ip in both codes.I have copied a code from code project...but not working.Can any one help me.
Regards
DilipRam
|
|
|
|
|
hi ....
i use follow code in C# for send a request to address: http://www.weather.ir/farsi/current/index.asp?station=99361
and get the response as a string .
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(txtAddress.Text);
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";
req.Timeout = 60000;
req.KeepAlive = false;
req.Timeout = 60000;
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
System.IO.Stream sm = res.GetResponseStream();
System.Text.Encoding enc = System.Text.Encoding.Default;
switch (ddlEnc.SelectedValue)
{
case "0":
enc = System.Text.Encoding.Default;
break;
case "1" :
enc = System.Text.Encoding.UTF8;
break;
case "2" :
enc = System.Text.Encoding.ASCII;
break;
case "3":
enc = System.Text.Encoding.Unicode;
break;
case "4":
enc = System.Text.Encoding.UTF32;
break;
case "5":
enc = System.Text.Encoding.BigEndianUnicode;
break;
}
System.IO.StreamReader sr = new System.IO.StreamReader(sm, enc);
txtSource.Text = sr.ReadToEnd();
sr.Close();
my problem is : in get string (result of request) some information that i need them is incorrect (i think is for encoding)
can you help me to solve this problem
thanks
|
|
|
|
|
using .net 2.0, Is it possible to schedule the windows service manually (i.e. from services window under control panel) or do I have to implement a timer inside the service i.e. in the code?
Currently I have scheduled the service to run on weekdays at 7:00 AM. This is done by having a timer in the code window.
Is there a way to do the same thing manually? i.e. is there a scheduled job window to set the time, days, etc...?
Thanks
|
|
|
|
|
arkiboys wrote: Is there a way to do the same thing manually? i.e. is there a scheduled job window to set the time, days, etc...?
Go to Control Panel -> Scheduled Tasks -> Add Scheduled Task
![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
Hi,
Not sure what which program to choose?
|
|
|
|
|
Choose the service which you want to schedule.
|
|
|
|
|
There is no windows service in the list
|
|
|
|
|
Dude, Even Windows Service is an .exe file with no interface.
Browse to the folder where you have installed or created that.
|
|
|
|
|
I see what you mean.
Many thanks
|
|
|
|