|
|
Hi,
Is there a Multiview control like in ASP.NET 2.0 (or like TNotebook component in Delphi), that can be used in a C# Windows Forms application? I didn't found such a component among the standard components shipped with VS 2005.
I need to change the displayed controls within a dialog, upon an event, but without tabs for each view (like in tab control).
Can anyone post some info on how can that be achieved in C# Windows Forms App?
Best Regards,
Yas
|
|
|
|
|
The easiest way is to create custom controls that each represent a possible view, expose delegates for events you want in your main form, and then show/hide those controls to get your views in the one form
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
Thank you for your answer!
I have one more question: Is it possible to use the tab control but with hidden tab buttons and if yes, how can I hide the tab buttons?
Best Regards,
Yas
|
|
|
|
|
I doubt it. You could perhaps create an owner drawn tab control that draws no tabs.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
try
{
cn=new SqlConnection("server=.;database=Stock_Accounting; integrated security=true");
cm_combo=new SqlCommand();
cm_combo.CommandText="select * from Cust_Info";
cm_combo.Connection=cn;
cn.Open();
SqlDataReader dr_combo=cm_combo.ExecuteReader();
comempnam.DataSource=dr_combo;
comempnam.DisplayMember="Cust_Name";
comempnam.ValueMember="Cust_ID";
dr_combo.Close();
cn.Close();
}
catch(Exception ee)
{
MessageBox.Show(ee.ToString());
}
it gives me an error " comblix databinding accepts as a datasource either an Ilist or an Ilistsource"
pleaze help me
MD_NADA
|
|
|
|
|
You need to data the data from the SqlDataReader and put it into a collection that implements either the IList or IListSource interface such as Dataset or Datatable.
|
|
|
|
|
use these instead of data reader
SqlDataAdapter da = new SqlDataAdapter(cm_combo);
DataTable dt = new DataTable("Table");
da.Fill(dt);
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "au_lname";
comboBox1.ValueMember = "au_id";
|
|
|
|
|
better still, just after you execute your data reader, insert a do while loop to iterate all rows read (i.e:
if(dr_combo.HasRows())
{
do
{
comempnam.Add(dr_combo["Cust_Name"]);
// or if you choose to display the Cust_ID then:
//comempnam.Add(dr_combo["Cust_ID"]);
}
while (dr_combo.Read());
}
cn.close();
hopefully, this should work.
'Tilewa
-- modified at 12:38 Sunday 24th September, 2006
|
|
|
|
|
hi all,
i want to ask my question with this illustration:
i have a pen object. then color property (typeOf(String)) of this pen can be "white", "red"... and it possibly can change. and i don't want to save it into the database but it needs to be managed at runtime.i.e a combo box will pick its items from it and an admin can (using a UI)change thye available colors. can i save this enum in the config file? how do i save at design time and how do i modify at runtime?
Thanks for any suggestion
|
|
|
|
|
You can serialise any item, so long as it's marked as serialisable, and can be rendered to and from a string. An enum will be fine in this regard.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks. But i think you are getting my question wrongly.
A pecil object has a Color property, TypeOfEraser property, Thickness(H,HB,B..) property..
Each of these properties are enumerable: Color.White, Color.Green...; TypeOfEraser.Big,TypeOfEraser.Red...; Thickness.H,Thickness.HB...; and these enumerations can be altered by an administrator of the app. rather than pull/push these values into an SQL db, i ask if it is better to save them in a config file. Now this means i'll have to be able to read the config file at runtime and persist changes too.
please how do i go aboout this?
thanks
'Tilewa.
|
|
|
|
|
As Christian said, you can serialize your object (Pencil in your case) to a file and read it back without writing any custom code.
Just mark your class with the [Serializable] attribute and you're ready to go. You need to make sure that types of member variables (and their members, essentially the whole object graph) is marked as [Serializable]. <code>Enum</code>s are serializable , so you won't have any problems there.
|
|
|
|
|
Hi!
How can i work with the Windows Media player control on my form i mean not in Asynchronously mode, how can i load it playlist or one sonf, and how can i play it?
Thanks
|
|
|
|
|
add mediaplayer into your toolbox.after that use of its property and events .
set axWindowsMediaPlayer1.URL= "Address of your mp3 or audio file" to run the mediaplayer.<br />
<br />
for stop :<br />
axWindowsMediaPlayer1.Ctlcontrols.stop()<br />
<br />
and other properties and events
|
|
|
|
|
i need these dll but i couldnt find them !!! how could i use them?
DLL:<br />
<br />
Microsoft.DirectX<br />
Microsoft.DirectX.AudioVideoPlayback<br />
Microsoft.DirectX.Diagnostic<br />
Microsoft.DirectX.DirectSound
|
|
|
|
|
They are part of the DirectX SDK. You'll need to download and install it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Nafiseh Salmani wrote: is that what you say?!!
Gee, does it LOOK like what I said ?
I recommend in future if people give you advice, you take the terminology they use and google it. You still need to download the DirectX SDK. .NET framework and DirectX are two different things, that's why they are spelled differently.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
.
|
|
|
|
|
Thanks , i install it and find those Dll .;)
|
|
|
|
|
What method in C# to View Text File ?
Thanks !!
|
|
|
|
|
View a text file? You mean launch a .txt file with the program currently associated with .txt files? That would be System.Diagnostics.Process.Start . Or do you mean show the contents of a text file inside your own Windows Form? For that, you just need to read the text of the file in using System.IO.File.ReadAllText, then put that text into a textbox on your form.
|
|
|
|
|
Thanks !!
Can U give me any example?
|
|
|
|
|
Can you first tell me what you're trying to do? Are you trying to launch a .txt file or show its contents in your own form?
|
|
|
|
|
I want to lauch a .txt, .doc, .xls File in my form
thanks for help !!
|
|
|
|