|
I have a Button (btnGet) on a UserControl which I am setting Image property of to a GIF.
The problem :
It does show in design time but doesnt on runtime.
(The UserControl has few other buttons which has their image property set to other images and working fine. However if I change their images to other, it doesnt work.)
Investigation :
I checked the .resx file and it contains the image data in the "btnGet.Image" element.
Put breakpoint in the InitializeComponents() where it assigns the image to button.
this.btnGet.Image = ((System.Drawing.Image)(resources.GetObject("btnGet.Image")));
resources.GetObject("btnGet.Image") returns null.
I tried this after deleting all the intermediate files like .pdb, .obj
When I set the image to a Button in other form in the same project (as well as in other). Works perfect!
Solution :
What could it be?
Every bit counts
|
|
|
|
|
Have you tried GetManifestResourceNames() to see if the image is present? that is asuming resources is an Assembly .
|
|
|
|
|
This should works...
this.btnGet.Image =global::yournamesapce.Properties.Resources.btn_image;
Note: you must add this image(btn_image) into Resource b4 running this code.
-
|
|
|
|
|
Hi
I've created a control which I want to look identical to a textbox. The only problem is I cant work out how to calculate the border colour for a normal textbox so I can set it onto my control.
I know I could probably do this by hardcoding RGB values but I dont think this is the best way incase it ever changes.
Any help would be very much appreciated.
Stu Richardson
|
|
|
|
|
hi
try out this class System.Windows.Forms.ControlPaint
|
|
|
|
|
Thankyou but unfortunately I did have a bash at that and could not resolve it. That class seems to work well with everything bar text boxes!
Thankyou for the idea though.
Stu Richardson
-- modified at 5:41 Thursday 29th June, 2006
|
|
|
|
|
Hello
I've got a problem ... as you can imagine ...
I have a WinForm with MaximumSize defined, and MaximizeBox enabled ...
My problem is that when user click on Maximize box, the winform got upper-left corner of the screen, and take the maximize size as defined, it's very weird ...
Is it possible to force the form centered when MaximizeBox is clicked ?
How to override this event ( MaximizeBox clicked ) ?
Thanks in advance for your help.
Sebastien.
|
|
|
|
|
Hello
There is no Maximized event to override. Instead try overriding SizeChanged event.
Something like this:
SizeChangedHandler(params...)
{
if(WindowState == Maximized)
{
if(Height > Screen.PrimaryScreen.WorkingArea.Height)
{
Top = 0
}
else
{
Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - Height / 2; //To center the Form vertically
}
if(Width > Screen.PrimaryScreen.WorkingArea.Width)
{
Left = 0;
}
else
{
Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - Width / 2; //To center the Form horizontally
}
}
}
|
|
|
|
|
As you said ur winform in MaximumSize then so u want ur winform in always maximized state right.. use Form's MaximizeBox property to disable Maximize button.
this.MaximizeBox = false;
Hope this helps u..
|
|
|
|
|
Hi!
I'm building a big xml string with a for loop and it takes veeeeeeeeeeeeeery much to complete this process. Later on I load it in an XmlDocument and save it in a file. This last thing takes no time.
The loop is something like:
<br />
string xml = "<Top>";<br />
for (int i=0; i < <ArrayList>.Count; i++){<br />
<br />
xml += "<Something>";<br />
xml += bla bla;<br />
xml += "</Something>";<br />
xml += <Object>.ToXml();
...<br />
...<br />
<br />
}<br />
xml += "</Top>";<br />
I know than the process may not be linear in time, but is there any known way to speed up this proccess? When the thing gets big (2MB xml file) it's really annoying to wait tons of minutes for this to save.
Thanx for any help!
|
|
|
|
|
For this you should use the StringBuilder Class.
Here I made a Method wich gives back a string.
public string CreateText(string[] textarray)
{
if(textarray != null)
{
StringBuilder lsb_Format = new StringBuilder();
for(int x=0; x < textarray.Length; x++)
{
lsb_Format.Append(textarray[x]);
}
return lsb_Format.ToString();
}
return "";
}
All the best,
Martin
|
|
|
|
|
|
hi,
Y dont u directly write it into file?
By adding string it consumes much more memory, try using StringBuilder.
Its available in System.Text namespace.
Thanks
Sushant Duggal.
|
|
|
|
|
Hai all,
I have a problem datagrid in Winforms about getting the selected row containing cells value,I know this is very simple in web application but i am new for win application can you please give the idea.
ranandbe
|
|
|
|
|
Hi,
If u want each column value of selected row then loop it with ColumnNumber
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber,
DataGrid1.CurrentCell.ColumnNumber)
|
|
|
|
|
Hi thanks for reply,
I can't get the Item property for that grid in Windows Forms Application, i thought you mentioned the web form grid control, is there any way to get web form grid control to win forms application.
ranandbe
|
|
|
|
|
yes in windows application only
u wil have item property check once again
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, DataGrid1.CurrentCell.ColumnNumber)
End Sub
|
|
|
|
|
How can i use RowFilter Property of DataView in C#?
|
|
|
|
|
RowFilter is used when you want to display some but not all rows of datatable based on some criteria. This criteria is specified in RowFilter. It is similar to that of using WHERE clause in your SELECT query.
For more reference please visit:
http://davidhayden.com/blog/dave/archive/2006/02/11/2798.aspx[^]
Regards,
Ketan.
|
|
|
|
|
How can we notify the client that the task has been completed by the windows service
|
|
|
|
|
i want to insert elemet of a array of ArrayList in a DataGrid. but how.plz help me.
|
|
|
|
|
Hope this helps you;
ArrayList.Rows.Clear();
for(int _x=0;x<ArrayList.Count;x++)
{
DataRow _row = DataTable.NewRow();
_row["???"] = ArrayList[x];
DataTable.Rows.Add(_row);
}
All the best,
Martin
|
|
|
|
|
See this example:
ArrayList arrayList = new ArrayList();
arrayList.Add(1);
arrayList.Add(2);
arrayList.Add(3);
DataTable dataTable = new DataTable("Table1");
dataTable.Columns.Add(new DataColumn("Column1", typeof(int)));
foreach(int i in arrayList)
{
DataRow dataRow = dataTable.NewRow();
dataRow["Column1"] = i;
dataTable.Rows.Add(dataRow);
}
this.dataGrid1.DataSource = dataTable;
|
|
|
|
|
Hi,
I have a big solutions which includes many c# projects and c++ projects. Some c++ project use the dll files generated by the c# projects. Now I begin to migrate the whole solution to 64-bit platforms. After setting the project, I found all the c# projects in this solution can not generate the expected dlll files.
I am a little confused. Could you help me if you are familiar with this?
Thanks a lot.
-- modified at 1:44 Thursday 29th June, 2006
|
|
|
|
|
As far as I know, there is no 64 bit compiler for C# or C++.NET. But for C++ (unmanaged) you can use for example Intel C++ Compiler.
|
|
|
|