|
Yes, I also agree with Eddy.
If you want you can make the 2 cols width (in Properties of that particular col) very small - just till what your text fixes, alos make Resizable = False & Padding (Cell style) = 0, 0, 0, 0. With this atleast you can amke min space/gap between both the cols and paint the other col or set its background/foreground color as per your choice.
To set properties of a particular cool, select grid, Column Collection, and then select your col & proceed.
Thanks & Regards,
|
|
|
|
|
Hi all,
I want to copy image stroed in the imagelist controle.
which location these images are stored?
Is any way by which we can find/copy these image Design or runtime?
|
|
|
|
|
Do you mean sort of this ImageList1.Images(i).Save(ByVal filename As String)
|
|
|
|
|
Dear Goutam , I have tried this
ImageList1.Images(i).Save("C:\Test.jpg")
Each time file is storing in a given path but when I am trying to open the image then image is not showing.
image size is 1 KB.
Thanks.
|
|
|
|
|
Hi
i have a form1 with one textbox1 and button1 when i click the button another form2 loads which has one textbox1 and button one when i type alfanumeric values in the textbox of form2 and press the button1 of form2 it is not displaying the value in form1 textbox1.
I am using property approach.
My code is as:
Form One:
<pre>
Public Class Form1
Public _form2 As Form2 = New Form2
Private Sub btnList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnList.Click
_form2.Show()
End Sub
Public WriteOnly Property _textBox() As String
Set(ByVal Value As String)
tbxVal.Text = Value
End Set
End Property
End Class
</pre>
Form Two
<pre>
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Dim frm As Form1 = New Form1
Value = _textBox1
Me.Close()
End Sub
Public ReadOnly Property _textBox1() As String
Get
Return tbxValue1.Text
End Get
End Property
Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim fm As Form1 = New Form1
fm.tbxVal.Text = Value
End Sub
</pre>
|
|
|
|
|
.NetDeveloper09 wrote: Dim frm As Form1 = New Form1
You are actually creating a new instance of form1 here. This instance is not aware of the value you set in the first instance.
Create a property in form2 and then set it in the form1 btnList_Click. You should then be able to get your textbox value in form2.
|
|
|
|
|
hi
i under stand, some one has replied to me which i believe is the answer but i have forgot how to do it.
"You need to retrieve the contents of the form2 TextBox control before form2 is disposed. To do that, you have to handle the Closing event for form2 inside form1. In that event handler, you simply use your property to retrieve the contents of the Form2.TextBox, and do whatever you need to with it."
|
|
|
|
|
I tried your way its not working, any other suggestion.
|
|
|
|
|
... you are allocating ("New") another instance in your Ok and Closed-Handler - this is a simple mistake. Your code smells like "beginner-style" maybe you want to learn about "variable scope"?
Solution:
1. Make a public property for Form2 which will give you the textbox.Text (you did that)
2. Read the property after showing the Form
-> Simple, isn't it?
3. Sit down and read a book about programming before you do further coding... (variable scope is always a thing you need to know, in any language)
Public Class Form1
Public _form2 As Form2 = New Form2
Private Sub btnList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnList.Click
_form2.Show()
tbxVal.Text = _form2.textBox1
End Sub
Public WriteOnly Property _textBox() As String
Set(ByVal Value As String)
tbxVal.Text = Value
End Set
End Property
End Class
|
|
|
|
|
Knowledge has no boundaries any one who struggles for it he gains the knowledge, one should not underestimate the person on the other side and should not pass remarks that hurt other poeple or discourage people.
You should show respect to people who are in your type of field. If you donot like to answer any question you are free to do that.
For your information i have already done it without your support.
Kind Regards
Mirza
|
|
|
|
|
I suggest you take the advice given to you, even when at first sight you don't like it much.
As for your problem, there is at least a dozen ways to "solve" it, unfortunately only one or two of these ways are decent, all others are bad, i.e. they work in a simple situation and will bite you when things become more complex.
It takes time and experience to learn it all, and most of all an open mind.
|
|
|
|
|
<Thank you for the advice, i always appriciate good advice, you are right there are and its true
also time is the only teacher, and most of all with an open mind is true and will to strugle in life and always give your thoughts a possitive direction, if one do that ones mind will always be open. >
|
|
|
|
|
This is a really common problem, and it's almost always answered incorrectly. Never, ever, attempt to use the instance scope to control the passing backwards and forwards of data between two modeless forms. Look to use delegate/events instead, and have the first form subscribe to an event on the second form which will be fired when it needs to return the data.
|
|
|
|
|
I have a method that queues a number of processes in a separate thread, long running stored procs. I want to disable controls and warn the user that the thread is still active so they cannot close the application while the thread is running.
I have a static class (clsMain) that has the property and the change event that is set from within the processing thread.
public static event EventHandler ProcessFlagChanged;
private static bool _IsProcessing;
public static bool IsProcessing
{
get { return _IsProcessing; }
set
{
_IsProcessing = value;
if (ProcessFlagChanged != null)
ProcessFlagChanged(null, EventArgs.Empty);
}
}
I now want to bind a buttons enabled value to clsMain.IsProcessing. This naturally does not work because clsMain is a type.
btnLoadPool.DataBindings.Add(new Binding("Enabled", clsMain, "IsProcessing"));
Is the design flawed or do I need to have another variable/event on the form to bind to?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Why do you choose a static class? If you drop the statics and instantiate it, all would be well.
And if you only want to have one instance at most, look for the singleton pattern.
|
|
|
|
|
Luc Pattyn wrote: Why do you choose a static class?
Well, because it's already there. I do want to reference this from at least 3 different places but that is a minor issue.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
smells like static abuse. OO requires you explicitly pass a reference around for the objects you want to use.
|
|
|
|
|
Luc Pattyn wrote: smells like static abuse
Yeah, yeah, where are my global variables, I'll revert to variant shortly.
Did the job properly, declared a class, passed the class from the main form to the processing form, used a BGW thread to do the work and everything hangs together nicely.
I don't use a lot of threading, I live behind the firewall and don't use a WAN, so latency is rarely an issue. This is slowly changing and the move to Silverlight is going to be interesting!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi i am using vs.net 2005 with c# window form
does anyone know how to make all the control inside the window form scale with the form
e.g when i enlarge the window form by 20% so will the control scale with it and also the text
|
|
|
|
|
Scaling is not a very definitive term in this case. You need to describe what each child control is. Is this for "zomming" graphics of some sort? If so, read up on the PictureBox functionality.
|
|
|
|
|
If it is just increase in the size of controls, proper anchoring/docking would do. You can use the TableLayoutPanel, it makes life easier.
For the text, you will have to redraw it using the methods in the Graphics class. You will need to use MeasureString and DrawString methods.
|
|
|
|
|
Ok, others said what you have to do (doking, manual resizing of the fonts and graphics, etc.)
What comes to my mind, when I hear such a requirement is: Is this really what you should do?
How many applications have you seen behaving like that (no dynamic layout but real resizing of a static layout)?
And if this is real necessary (because you are writing an app for visually impaired, or whatever) you are maybe using the wrong platform. (e.g Scaling is very simple to do with WPF/Silverlight)
|
|
|
|
|
Hi all,
i'm using ASP.net C# Windows Forms to develope an application and i want to know how can i set icon for .exe file?
not the icon that appear on taskbar after douple click on .exe file but i mean the icon for .exe file itself.
i want to change the normal icon.
Thanks
Abdullah
|
|
|
|
|
Abdullah S. Abdelhay wrote: how can i set icon for .exe file?
Change the setting in the properties of your main form.
It's time for a new signature.
|
|
|
|
|
If compiling from command line ( csc ) use the switch /win32icon.
If developing in Visual Studio, go to Project, Properties, the in the Application Tab where is says Icon.
|
|
|
|