|
Well, tahnks.
That would have been the content of the link:
using System;
using System.Windows.Forms;
using System.Data;
using System.Collections.Generic;
using System.ComponentModel;
namespace WindowsApplication102
{
public partial class Form1 : Form
{
public Form1() { InitializeComponent(); }
private void Form1_Load(object sender,EventArgs e)
{
Person[] personen = new Person[]{new Person("Frank",42),
new Person("Eva",34), new Person("Luca",2)};
dataGridView1.DataSource = personen; this.Width = 300;
}
public class Person
{
private string name;
private int alter;
private DateTime geburtstag;
public override string ToString()
{
return (name);
}
public Person(string name,int alter)
: this(name,alter,DateTime.Now.AddYears(-alter)) { }
public Person(string name,int alter,DateTime geburtstag)
{
this.Name = name;
this.Alter = alter;
this.geburtstag = geburtstag;
}
[DisplayName("MeinName")]
public string Name
{
get { return name; }
set { name = value; }
}
[Browsable(false)]
public int Alter
{
get { return alter; }
set { alter = value; }
}
public DateTime Geburtstag
{
get { return geburtstag; }
set { geburtstag = value; }
}
}
}
}
|
|
|
|
|
delete
modified 2-Apr-21 5:24am.
|
|
|
|
|
For the xml file, you can use Build Action as Embedded Resource. But this means that you will have to change the way you read the xml file now. You will have to read it from the assembly.
For Dlls, do you have the source code?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
yes i have the source code can you explain me how that careful work with the xml how i must drop it and how can i open it?
pc17
|
|
|
|
|
If the dlls are written in C# and you have the source then you can do it this way:
Create backups of everything - just in case!
Open the project that is compiled to the exe.
In that solution, choose Add Existing Project for each of the projects that compile to dll and add each one.
Create folders with the same names as the dll projects in the exe one.
Select all files in each dll project and drag and drop to the respective folder.
Remove the dll projects from the solution.
You may have to play around a little if any of the projects are using a resources file etc, but generally speaking it should just work.
|
|
|
|
|
Yes, but...
I create the directory first and add right into it and I usually Add as link so I don't copy the files needlessly.
|
|
|
|
|
PC17 wrote: must be in the same folder otherwise the program doesn´t work
That's not entirely true.
You can probably embed the XML in the EXE as a resource.
If you wanted the EXE and DLLs in one file, why did you make the DLLs?
|
|
|
|
|
That i can use it for more things so i have no very long source code!
Who would this work with the resoucen i take the 4 files as resouce and then how can i open it?
PC17
|
|
|
|
|
PC17 wrote: That i can use it for more things
Consider putting the DLLs in the GAC.
|
|
|
|
|
When all code is C#, you could create a single project holding all the source files; and add the XML file to it, with BuildAction=EmbeddedResource. Then you need a bit of code to extract the XML as a string, replacing your file reading code.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
For the xml file, add it as an EmbeddedResource as others have already said.
For the dlls, can use ILMerge to merge them with your exe.
|
|
|
|
|
i'm trying to create 2 custom controls, once you compile, you have a nice custom control up in the visualstudio I.D.E..
i would like to achieve, the once a dragged 'MenuStrip' onto my form and start adding item, that these items are also a new created costrum control 'cToolStripMenuItem', instead of standart item
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
namespace OwnerDraw_Test_3
{
class CMenuStrip : MenuStrip
{
}
class cToolStripMenuItem : ToolStripMenuItem
{
}
}
kind regards
Bad = knowing 2 much
modified on Thursday, September 24, 2009 2:41 PM
|
|
|
|
|
And your problem is?
What have you tried?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
wel, i'm trying to achieve, that items added to the menuStrip, are the items from my class and not the standart System.Windows.Forms.ToolStripMenuItem().
without anyneed to manualy moding the form1.designer.cs
this.ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem1 = new OwnerDraw_Test_3.cToolStripMenuItem();
Bad = knowing 2 much
|
|
|
|
|
Well, you are deriving your own class from MenuStrip, so you are in control of what happens in there. All you have to do is override any methods/events where a MenuItem is added/inserted/deleted. That is a lot of work, though.
Alternatively you can just create your own OwnerDraw_Test_3.cToolStripMenuItem() , as you are doing. What else you need to do will depend on whether you are only going to add them in code, or if you need design time support.
For design time support, look up the documentation for the ToolStripItemDesignerAvailability attribute. From there you should find links that will help you in designing the cToolStripMenuItem .
For code only implementation, it is surely only a matter of casting to cToolStripMenuItem wherever there is interaction with your control.
Sorry not to be more help, but my internet connection is playing up, and it takes about 5 mins to get a google search up at the moment, otherwise I would have given you more specific links.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
hi friends...
am working with .net 3.5,am developed one web service now i want to access that web service by using c# windows application,but there is no add web reference option in context menu when i am right clicking on root node of the application(windows application)..please..
help me...any idea to get that option..
txs
in advance..
|
|
|
|
|
priyareguri wrote: am working with .net 3.5
There is this difference between how it used to be in earlier .Net version.
From 3.5 onwards, you dont see it as Add Web Reference, but you have a menu option Add Service Reference
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Thanks for your help man, I was also facing the same problem.
|
|
|
|
|
Hi,
Does the Add Service reference the same as Add Web Reference?
|
|
|
|
|
|
I have a WinForms app. I have various DataGridViews throughout my app in which I use a combobox column. One in particular will only display the display member when that column has focus EVEN THOUGH I have set the DisplayStyleForCurrentCellOnly property to false. Has anyone encountered this and, more importantly, solved it?
modified on Thursday, September 24, 2009 1:15 PM
|
|
|
|
|
I finally discovered what was causing the error. In the DataTable definition for the column in which the combobox was not being displayed, the datatype was defined as Int16. I changed it to Int32 and it works swimmingly.
|
|
|
|
|
I do write a quiz Program and i want When start quiz,my form be fullscreen and users can't exit question form i want even TaskManager on the below this form.
Tanks
|
|
|
|
|
mansoury wrote: and users can't exit question form i want even TaskManager on the below this form
... then I don't want to be using your application! Think of yourself as the end user - if you installed a program that did this, you would be very unhappy.
|
|
|
|