|
hi there, i think this will help
from the first form you have to raise an event (on click of something ex. button) and you write this code :
Form frm = new Form();
frm.MdiParent = this;
frm.Show();
and i will depend on that form, from where it was opened,
respect.
spaps
|
|
|
|
|
Hi Shpends,
Thanks for the quick reply. But it seems to me that your code shows up a child form.What I need is showing a child form that is called from the previous child.
I mean, if we call the first child form X and second child form Y, I try showing Y through X and I can't set the MDIParent property because I call it from an MDIChild form not from the MDIParent itself.
I hope the explanation above is clear enough. =)
Thanks again.
|
|
|
|
|
Try this...
In the MDIParent (Form1)
private void Form1_Load(object sender, EventArgs e)
{
Form2 newForm = new Form2(this);
newForm.MdiParent = this;
newForm.Show();
}
for 1st Child (Form2)...
public Form2(Form mdiParent)
{
InitializeComponent();
_mdiParent = mdiParent;
}
private Form _mdiParent;
private void Form2_Load(object sender, EventArgs e)
{
Form3 newForm = new Form3();
newForm.MdiParent = _mdiParent;
newForm.Show();
}
with Form3 being the 2nd Child.
Obviously you need to dispose of the forms somewhere but should get you going.
|
|
|
|
|
Hi DaveyM69,
Thank you very much for your help. It works just fine.
Thanks again.
|
|
|
|
|
hi,
im working on a customer recording sw. i need to get the customers from the db according to the specifed keywords. firstly i wrote a stored procedure and i executed it and it is working but with datagrid it is not. then i wrote a less specific procedure into the c# code, if i didnt write any parameter it is working, i see the customer info in the datagridview but with a parameter the datagridview is empty. here is the code:
string connStr = "Data Source=ZEYNEP\\SQLEXPRESS;Initial Catalog=Esmira;Integrated Security=True";
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = conn.CreateCommand();
SqlParameter param;
param = new SqlParameter("@ad", SqlDbType.NVarChar);
param.Value = "zeynep";
cmd.Parameters.Add(param);
cmd.CommandText = "SELECT * FROM musteri where ad=@ad";
DataSet dataset = new DataSet();
SqlDataAdapter dataadapter = new SqlDataAdapter(cmd);
dataadapter.Fill(dataset,"FOO");
dataGridView1.DataSource = dataset.Tables["FOO"];
here "cmd.CommandText = "SELECT * FROM musteri where ad=@ad";" if i write "ad=zeynep" it is ok but "ad=@ad" is not working.
does anyone have an idea about it???
|
|
|
|
|
Hi,
I have added a dynamic column to the datagridview.
In every row of this column there is a checkbox.
Not sure why I can not check these checkboxes as I click on them.
In case it makes any difference, I am leaving the autogeneratedcolumn as the default and so I am not setting it.
This briefly shows you what I am doing...
dtPricesSourcesBest.Columns.Add("AcceptPrice", typeof(Boolean));
dgvSecurityPricing.DataSource = null;
dgvSecurityPricing.DataSource = dtPricesSourcesBest;
Any ideas please?
|
|
|
|
|
arkiboys wrote: Any ideas please?
Look at the properties for the column. Make sure you have them all initialized properly.
|
|
|
|
|
Solved it.
The problem was that all the columns were set to readonly.
Thanks
|
|
|
|
|
I have an application that loads the default country from a country table based on the user's login credentials. However I have a combobox(as part of addres fields) that loads all countries from a countries table. I would like the combobox to default to the default country.
eg. if a user login in US I want US as the first item in the combobox.
Please help
Thanks
Tawa
|
|
|
|
|
You could do it like this:
private void YourFormForm_Load(object sender, EventArgs e)
{
int defaultCountryIndex = 7;
countryComobBox.SelectedIndex = defaultCountryIndex ;
}
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Is it possible to get the index from the combobox instead of hard coding the value. I am trying to avoid a situation where I have to provide values for all countries
|
|
|
|
|
TawaPower wrote: Is it possible to get the index from the combobox instead of hard coding the value. I am trying to avoid a situation where I have to provide values for all countries
Yeah, I was just giving a simple example of what you could do. Definately not a good idea to hard-code anything like that. What you could do is:
Once you have the country from the user, you iterate over each county in the combobox, and once you find the match for the user's county you have the index of it(you iterator value in your for loop), and set the selectedindex to that value.
-- modified at 11:22 Tuesday 13th November, 2007
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
am putting background image on ListView control. But items on list view are coming in white background. I set item background color to transparent but it still has white background. Any idea how to resolve it?
|
|
|
|
|
|
Hi does anyone know how i can get the names of all available classes wich are derived from a base class ?
|
|
|
|
|
Here's how to get all derived classes of a base class in one assembly:
List<Type> derived = new List<Type>();
Type baseClassType = typeof(BaseClass);
foreach(Type t in baseClassType.Assembly.GetTypes())
{
if(t.IsSubclassOf(baseClassType))
{
derived.Add(t);
}
}
|
|
|
|
|
With this code you can get all derived classes from the current assembly and its referenced assemblies... (this should be all assemblies in the project)
List<Type> derives = new List<Type>();
foreach( AssemblyName name in Assembly.GetExecutingAssembly().GetReferencedAssemblies() ) {
Assembly assembly = Assembly.Load( name );
foreach( Type class in assembly.GetTypes() ) {
if( class.IsSubclassOf( typeof( BaseClass ) ) ) {
derives.Add( class );
}
}
}
|
|
|
|
|
It will be all referenced assemblies, but not necessarily all assemblies in the project. Referenced assemblies are those that are actually listed in the References tree in Visual Studio and imported by namespace into the project. If you have any late bound assemblies (assemblies loaded by reflection using Assembly.Load() ), they won't be in this list.
|
|
|
|
|
Hi...
I have been working with a image thing and all the stuff i have done is with the system.drawing.image part. now i would like to use some of the system.drawing.bitmap fetchers and would like to do it with out saving the Image to file and opening it as a Bitmap.
Running in VS2005 C#.
I have been trying all sorts of things i have read all around the Internet but just cant seem to get the right syntax.
all help would be greatly appreciated.
thanks
|
|
|
|
|
Bitmap bit = new Bitmap(image);
|
|
|
|
|
What!? You mean it's that simple? After all the hours spent researching this if I had only read the documentation, Bitmap.Bitmap(Image) Constructor
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: You mean it's that simple
True. System.Drawing.Imaging is a magic wand in fact. I was inspired to put down a few points on the same as an UtilityAPI here:
http://dotnetspider.com/kb/Article3446.aspx[^]
|
|
|
|
|
I have a 3rd party treeView Control which shows its own context Menu on right click. I want to override it with my Own.
I set control's CONTextMenu to my own contextMenu , what actually happening that it shows all items as Disabled. Also shows default context Menu.
Help me please!
|
|
|
|
|
Hi Adnan, it's been awhile.
Try inheriting from the control and overriding OnMouseDown. When that occurs, show your own context menu.
|
|
|
|
|
yeah, not much into soapbox thingie due to time and since I was not in MS technologies for long time so was not participating in other forums either
i am away from net for long time, could be take ma as DUMMY and give some rough example what do you mean by Overriding OnMouseDown?
I am actually tracking MouseUP event. When user clicks right button, I am setting control.contextMenu to my Context Menu at the location of Mouse clck(e.x,e.y)
I am surprised why the heck it shows disable Items?
|
|
|
|