|
Mo Chips wrote: how to keep my reults from being displayed on one line
If you use a ListBox as suggested earlier then assuming your ListBox is called listBoxResults and your text is in a string called yourResultString then:
listBoxResults.Items.Add(yourResultString); Doesn't get much easier.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I understand what you're saying but it's also bad to get into bad programming habits, so better to optimism as much as possible.
I just had a go at doing it and it took me about 10 min
|
|
|
|
|
Its displaying the results all on oneline... how do i get it on seperate lines??
|
|
|
|
|
sorry... see the edited code.
But adding a new line in a string is something you should know before doing anything like this... so if you are willing to learn as you said then you should go to whomever set the homework and ask for some good book/websites for the basics.
...or you could use a listView then you wouldnt need the newlines
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi there,
Is there a way to have the TabControl on a WinForm without showing the Tab header?
Kind regards,
Jr
|
|
|
|
|
Yes, use a panel!
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Why would you want to?? You could just use different panels!
|
|
|
|
|
I think Ashfield and hopingtocode are (understandably) confused as to why you want to do this. If you created a TabControl without a tab header, how is the user going to select the tab division they want to veiw?
What are you trying to achieve?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Well, I'm trying to create a wizard like interface. I will then add a Next and Previous button and provide the user with the ability to navigate through the pages.
|
|
|
|
|
There are some wizard controls out there but I would use panels to do the information display. Tab is for when you want them all viewable
|
|
|
|
|
OK. Create a form, with a panel which occupies most of space, leaving enough for your buttons - lets call it panelSpace.
Create your individual panel fillers by Project...Add...NewItem... UserControl - this creates a blank panel filler - lets call it panelA. Set its Dock property to fill the panel, and place your controls.
When you want to display the items from panelA:
panelSpace.Controls.Clear();
panelSpace.Controls.Add(panelA);
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
OriginalGriff wrote: Set its Dock property to fill the panel,
No I'm an idiot - it doesn't have a dock property - ignore that bit! Must be a tuesday again...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks Original Griff for this. This works!
|
|
|
|
|
You're welcome.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Try that derived class form TabControl. It simply overrides the DisplayRectangle and adds a ShowTab Property for your new TabControl class. Does it help you ?
public class MyTabControl : TabControl
{
public override Rectangle DisplayRectangle
{
get
{
if (showTabs)
{
return base.DisplayRectangle;
}
else
{
return new Rectangle(0, 0, Width, Height);
}
}
}
#region Properties
private bool showTabs = true;
[Category("Apparence"),
Description("Indique si les onglets s'affichent."),
DefaultValue(true)]
public bool ShowTabs
{
get { return showTabs; }
set
{
showTabs = value;
RecreateHandle();
}
}
#endregion
}
|
|
|
|
|
Pyrrhon you're a Genius - your answer was exactly what I was looking for. Thank you again.
|
|
|
|
|
I'm glad to help you. Just a little thing : when you add a lot of TabPages, 2 tabpage scroll buttons appear in the TabControl. To hide them, just set Multiline=true. However I suppose you knew it.
Bye
|
|
|
|
|
Hi,
In my project I have to place the existing user controls dynamically on a form at the given location. That is I will give the X-axis and Y-axis values in the text boxes dynamically then the existing user control should be dynamically created at that location.
If any one have any idea to solve this, please reply me as soon as possible.
Thanks in advance.
|
|
|
|
|
This is quite trivial, you should buy a book and read it. The Petzold book is good in this regard.
You add the control to the form's controls collection and you set it's position.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
If using 2.0 or above you can use a generic function such as this in your form.
private void AddControl<T>(string text, Point location, Size size) where T : Control, new()
{
T control = new T();
control.Text = text;
control.Location = location;
control.Size = size;
this.Controls.Add(control);
} and call it like
AddControl<Button>("New Button", new Point(12, 12), new Size(75, 23));
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Well blinking 'eck. I never knew that Control had a text property. Just assumed it was lower down in the class hierarchy on certain controls. That's what I've learnt today.
Regards,
Rob Philpott.
|
|
|
|
|
Control has got way too many properties IMO. Deriving from it to create a new control is a PITA as you have to try and hide all the non relevant ones (and methods too) which is not only messy/time consuming but very non OOP.
If they had a IControl interface that just had the basics required, and a form's Controls property was a list of IControl it would be way better.
Something like
interface IControl : ISynchronizeInvoke, IWin32Window
{
bool Enabled { get; set; }
Point Location { get; set; }
Size Size { get; set; }
bool Visible { get; set; }
}
public abstract ControlBase: IControl
{
...
} It'll never happen though
[Edit] Made a mess of Interface with ControlBase stuff in it [/Edit]
Actually, now I've thought about it a few minutes - just the ControlBase (would need a little more than I provided so we can have OnPaint etc to override) would be enough. Give me ten minutes and I'll probably change my mind again!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Tuesday, May 12, 2009 11:20 AM
|
|
|
|
|
unless I'm missing the point entirely wouldnt it be something along these lines:
yourControl.Left = Convert.ToInt32(yourXPosTextBox.Text);
yourControl.Top = Convert.ToInt32(yourYPosTextBox.Text);
or at least thats how I position controls within a form, if you mean something else ginore me
|
|
|
|