|
As long as the dataset exists and the datagrid's datasource property is set, filling the dataset in the c.tor has always worked for me... maybe paste some code (including your initializecomponent method) and it would be easier to see your problemo.
|
|
|
|
|
So, there is no special attribute for designer region. That’s ok. Maybe I've pasted fill method to the wrong constructor.
Let’s simplify my question, so there is no need to paste a lot of code.
Now I have a form & a button. There is my form constructor.
public Form1()<br />
{<br />
InitializeComponent();<br />
this.button1.BackColor = Color.Red;
}<br />
Initialize component is fully generated by designer and not takes a point of interest for us.
Please help me. In which class constructor I've to paste "this.button1.BackColor = Color.Red" to have colored button in the designer?
Dizzy
|
|
|
|
|
As far as I know, you cant create any method that the designer will run when creating a new instance of the control/component. It only does that with InitializeComponent() and it must be hardcoded because the method doesnt have any Atribute to tell the designer to run it in design time.
The only way u might be able to achieve what I think you want is creating some Browsable Get/Set property and putting the DataSet binding code in the setter. Then create a new form inheriting from the one u just created and go back to the designer and change the derived form's property. That should run whatever code you want.
Haven't tested it, but it should work. I dont know what the use in doing this is unless u want to get a better idea in design time how ur DataGridStyle is looking when displaying data but ...if thats the case, once it looks good just copy all generated code to ur original form and ur set.
|
|
|
|
|
How can I allow the Form to only do paint and move, resize, maximize and minimize events? I have the code for paint below.
private const int WM_NCPAINT = 0x0085;
private const int WM_PAINT = 0x000F;
private const int WM_ERASEBKGND = 0x0014;
private const int WM_PRINTCLIENT = 0x0318;
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)]
protected override void WndProc(ref Message m)
{
if (this.Buzy)
{
if (!((m.Msg == WM_PAINT) || (m.Msg == WM_NCPAINT) || (m.Msg == WM_ERASEBKGND) || (m.Msg == WM_PRINTCLIENT)))
{
return;
}
base.WndProc(ref m);
}
|
|
|
|
|
try this:
private bool allowPaint = false;
protected override void OnPaint(PaintEventArgs e)
{
if(this.allowPaint)
{
base.OnPaint (e);
}
this.allowPaint = false;
}
protected override void OnResize(EventArgs e)
{
this.allowPaint = true;
base.OnResize (e);
}
protected override void OnMove(EventArgs e)
{
this.allowPaint = true;
base.OnMove (e);
}
|
|
|
|
|
Hi
I had an resorce in my Assembly (Bitmap) and need to get resource ID of one, for pass to an function.How i can do this??
Please help!!!
|
|
|
|
|
There's no resources IDs like with native images - they have the name that you gave them when you compiled your assembly.
To get a list of the names, use Assembly.GetManifestResourceNames . To actually get the stream, use Assembly.GetManifestResourceStream .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I am trying to convert project originally written in SDK to .NET and came accross a problem that SetPixel function is not available anymore in .NET's GDI+. The function in original code was used to paint a grid (or I should better say a dot matrix) in a sort of a vector editor.
The SetPixel function is available in Bitmap class, but that won't help me, I guess.
Of course to draw a line just 1 pixel long does not work,
thus I would like to ask for any suggestion how to realise this in .NET
Lost In China
|
|
|
|
|
Probably easiest to just create a Bitmap, draw to it using SetPixel, then render it to the window (or whatever you have) using GDI+
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I had this problem as well. In VisualStudio 2002, I used the FillRectangle function with a rectangle that was 3 X 3 pixels. This would produce on pixel, filling the inside of the 3 X 3 rectangle fed to it, but not the rectangle border itself. In VS 2003, (using the newer .Net 1.1.1 framework) I beleve, the rectangle only had to be 1 X 1 pixel as the FillRectangle function now fills the border and the inside. You'll have to double check me on the detials, but the FillRectangle function is what your looking for.;)
|
|
|
|
|
Thanks Adam, FillRectangle(brush, x, y, 1, 1) does the job . Hope the function doesn't have too much overhead in comparison to SetPixel.
|
|
|
|
|
|
gavinJeffrey wrote:
Hi,
Erm, Hi
Can we help?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I pushed enter to go to a new line but instead it posted the page (not the first time this has happened either). Yeah i did have a question but I figured it out. I also went and deleted my post straight away after I realized what I had done - dont know why it is still here though - just one of those days I guess.
|
|
|
|
|
Hi,
i want to embed a signed windows forms control (assembly with strong name, using a .snk key pair) into a html page. Using the normal <object>-tag works fine with the unsigned control, but doesn't work with the signed one! The signed control doesn't even open! In both cases i used the same html code. Is there information missing (e.g. about the key pair)?
Thanks a lot for your help!
Fridtjof
|
|
|
|
|
Hi,
here some additional informations:
1. I used sn -k key.snk for generating the key pair.
2. Then I used an attribute in the AssembyInfo.cs file to sign the control:
[assembly: AssemblyKeyFile("key.snk")]
3. In the html page the code
<object id="A" classid="http:ALib.dll#ALib.MyACtl"
width="568" height="416">
</object>
worked fine with the unsigned control. I used exactly the same code with the encrypted control. It seems to me that Internet Explorer cannot find the class "ALib.MyACtl" any more. Maybe since it is encrypted now???
Thanks for any advice,
Fridtjof
|
|
|
|
|
Hello,
I write a C# application MyApp.exe
MyApp need to read the version of an exe written in c++(VC6++)
I try with Assembly.loadFile("path\\app_vc6.exe")
but I get an error
Assembly.loadFile work corectly with an C# exe
did someone have an idea how to do it?
|
|
|
|
|
The Load methods of the Assembly type can only be used with .NET assemblies. To get the version info for any file, use: System.Diagnostics.FileVersionInfo.GetVersionInfo(fileName)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hello Everybody, this is my first time posting to the forums, so... "Hi, My name is John, and I'm a code-aholic..."
I have a question about COM performance in .Net applications. I am trying to write a program interface's with Apple's COM library for the iTunes app on windows in order to get access to the library of tracks and I am having some serious performance issues.
I am basically trying to load the library into a typed Dataset for easier manipulation in C# as the COM interface is pretty limited, and it is taking about 10 minutes to load the entire library. I am using a foreach loop over the library's Tracks collection to add them into the dataset.
I was just wondering if anyone else out there has done anything with the iTunes interfaces and if so if you have any tips on how to improve performance???
|
|
|
|
|
Can you specify the sort order of a hashtable? I’m using a string as the key and a home made class as the value.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
System.Collections.Hashtable does not support sort order. It stores the data as Key, value pair.
Though I just found an article dealing with what you want.
Hashlist - Hashtable meets ArrayList
[^]
Hope this helps you.
|
|
|
|
|
Thanks!
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
Hi,
I want to export some data from an Excel file to a Database.
How can I connect programmatically to Excel?
How can I export from Excel to Databse?
|
|
|
|
|
I suggest you do a search for excel on codeproject. I found lots of useful articles on CP about this. I cannot remember the name of the article, but there is a good one on connecting to Excel using ODBC which I think will help you a lot, as you could load this information into a dataset, then connect to sql, etc.
|
|
|
|
|
Thanks.
But I couldn't find so in CP.
|
|
|
|