|
I try to do this but dataGrid1_Paint(); dosn't work
private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics gs = dataGrid1.CreateGraphics();
SolidBrush br = new SolidBrush(Color.Red);
gs.FillEllipse(br,X,Y,10,10);
}
|
|
|
|
|
Can anybody tell me how to run script file on sql or oracle databse though .net?
Nana
|
|
|
|
|
If you want to run a SQL Server script, you can use Process.Start to run osql.exe (or sqlplus for Oracle). Alternatively, depeding on what the script does, you could read it in and execute the commands directly.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I need to delete all the radiobuttons in a panel (other controls are in panel as well). This code I came up with only seems to get ride of some, but not all (
foreach (Control control in panel_Label.Controls)
{
if (control is RadioButton)
{
control.Dispose();
}
}
thanks,
Ron
|
|
|
|
|
Probably some of the radio buttons aren't direct child controls of the panel, but childs of childs (of childs ..) of the panel.?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi Rick,
All radio buttons are added at run time with this code (to the same panel):
RadioButton newPointer = new RadioButton();
newPointer.Size = new System.Drawing.Size(78, 16);
newPointer.CheckAlign = ContentAlignment.TopLeft;
newPointer.TextAlign = ContentAlignment.TopLeft;
newPointer.FlatStyle = FlatStyle.Flat;
newPointer.Text = pointerName;
panel_Label.Controls.Add(newPointer);
thanks,
Ron
|
|
|
|
|
myNameIsRon wrote: Hi Rick
I'm not Rick. It's the person I cite in my signature.
myNameIsRon wrote: All radio buttons are added at run time with this code (to the same panel):
OK, so no recursion or iteration of additional controls is needed. Try to explicitely remove the radio button from the panel before disposing it.
foreach (Control control in panel_Label.Controls)
{
if (control is RadioButton)
{
panel_Label.Controls.Remove(control);
control.Dispose();
}
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
Thanks for your help.
I tried your code, but same thing is happening. If I change anthing else, it works fine:
foreach (Control control in panel_Label.Controls)
{
if (control is RadioButton)
{
control.Text = "New Text";
}
}
Ron
|
|
|
|
|
Errh, should have seen it immediately. The problem is the foreach loop that prevents you from changing the iterated collection. Change it to a for loop and it should work.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
try this
call the method on pageload
RemoveRadioButtons(MyPanel);
here's the method...
public void RemoveRadioButtons(Control parentControl)<br />
{<br />
foreach(Control childControl in parentControl.Controls)<br />
{<br />
if(childControl.HasControl())<br />
{<br />
RemoveRadioButtons(childControl);<br />
}<br />
elseif(childControl is RadioButton)<br />
{<br />
parentControl.Controls.Remove(childControl);<br />
}<br />
}<br />
}
Regards,
Mark
|
|
|
|
|
i want to tell application to chane location of button on runtime
for example
if i want to change button2.location
button2.location=""
but if i had ten button on my form
and when i click button
and then click on another button swap button's location
so when we run the application we do't know what the two buttons will be clicked
so how to programming this situation
ma_refay
|
|
|
|
|
You can identify buttons with the Name property. You can relocate them with the Left and Top properties.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
i want to get the control name during runtime
FOR EXAMPLE i want to return button2 name during runtime to use it
ma_refay
|
|
|
|
|
Use the Name property, e.g. button2.Name .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
This is extremely complicated. In order to get the name of a control, you have to use a property. To get access to a property you first have to access the control, which is done by writing the name of the control into the code. Then you put a period after the name. Not before or in the middle of the name, but after the name. This is very important. Then you have to specify what property it is that you want to access, and that is done by writing the name of the property after the period. To get the right property, you have to know the name of that exact property. In this case you want the property that returns the name of the control, which for some strange reason has been called Name. So by typing those four letters after the period, you gain access to the value that the property returns.
Now, have a go at putting this complicated code together, and come back with any questions you might have.
---
single minded; short sighted; long gone;
|
|
|
|
|
I use the Visual Studio 2005. Now I want to use different Resource.resx and Settings.settings. With the configmanager I want to select the Resource.resx and Settings.settings.
|
|
|
|
|
For to get a different resx u can load from a file
System.Resources.ResXResourceSet resxSet = new System.Resources.ResXResourceSet("C:\\...");
for to load Setting I can't remeber now
|
|
|
|
|
This code runs fine.
When it's run, output says Struct A's size is 16 and Struct B's size is 12, even though
both contain 2 ints and 2 chars each.
Can someone tell me how the heck that is possible?
#include "stdafx.h"
#include <iostream>
using namespace std;
struct
{
char c1;
int i1;
char c2;
int i2;
}a;
struct
{
int i1;
int i2;
char c1;
char c2;
}b;
int main()
{
cout<<"sizeof struct A " <<sizeof(a);
cout<<"sizeof struct B " <<sizeof(b);
getchar();
return(0);
}
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
yeah...err...this is the C# forum...
|
|
|
|
|
Although you posted in the wrong forum, I will try to answer your question.
A char is aligned on a two byte boundary and an int is aligned on a four byte boundary. The structs will be padded with unused bytes to align the values.
This represents the memory layout of the structs, where _ represents an unused byte:
a: c___iiiic___iiii<br />
b: iiiiiiiic_c_
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I agree in general, but your "A char is aligned on a two byte boundary" surprised me;
I expect it to be true in C# (because char=2B), and false in all C compilers I know.
Normally variables get aligned on a multiple of their natural size, hence 1 for char
in C/C++. Is it different in C++ ? or is Microsoft doing special things, if so
what would be the main reason for this ?
Best regards.
|
|
|
|
|
You are right, a char is not aligned on a two byte boundary. The b structure will of course be aligned as this:
b: iiiiiiiicc__
The structure is aligned on a word (32 bit) boundary.
The alignmment is all up to the compiler. If it was more efficient to access a byte at an even word address, it would probably have aligned it like this:
b: iiiiiiiic___c___
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi all. I am using daReport to create a report and i need an image on the report. I thought it would be as easy as sending the image name: "Test.jpg" as a parameter to the xml file and daReport would use that as the the image name. but no such luck as yet.
The parameter name is logopath:
<parameter name="logopath" />
i tried to use it like this...
<pictureBox x="457" y="26" width="314" height="130" strech="true"><br />
<file>$P{logopath}</file><br />
<border width="1" color="Transparent"></border><br />
</pictureBox>
This then shows a blank spot where the image should be.
i used the same for a text field...
<textField x="601" y="206" width="100" height="23"><br />
<text horAlignment="Left" verAlignment="Top">$P{logopath}</text><br />
<font family="Tahoma" size="10" ></font><br />
<foregroundColor color="Black"></foregroundColor><br />
<backgroundColor color="Transparent"></backgroundColor><br />
<border width="1" color="Black"></border><br />
</textField>
This worked fine as it showed the text: "Test.jpg". How would i use this text as the image name?
Thank you in advance.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Won't the author of daReport be the best bet for an answer to this question?
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
okay... i just thought that someone might have used it and would know the answer. but i will ask the author.
Thank you anyway.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|