|
well one thing you could do is override the tostring method, and throw your own variable in there that would add some meaningful text, have you tried that?
Ryan
|
|
|
|
|
that would require me writing a class derived from combobox that was familiar with class i was adding to the combobox.. so it would work, but only for one type of class.. i dont understand why there is no tag property for the items..
c++ would be like:
for (int i = 0; i < MySet.GetSize(); i++)
{
MyObject* pObj = MySet.GetAt(i);
int nPos = MyComboBox.Add(pObj->m_strText);
MyComboBox.SetDataPtr(nPos, pObj);
} that way when i handled the selection changing i could have a pointer instantly to the item it was changed to.. ah well..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
if i understand correctly, your trying to get text from objects that you add into the combo box. All objects in c# support the tostring method, it is a method of the base class, so you wouldnt have to do any extra inheritance.
|
|
|
|
|
AAAAAH.. i see what your saying..
sorry im a bit slow sometimes.. i guess that makes perfect sense, thanks!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
well, i thought this would work, but it doesnt..
this.cbCountyDefault.BeginUpdate();
for (int i = 0; i < m_saCountyRecords.Count; i++)
{
GASTCountyRecord objRecord = (GASTCountyRecord)m_saCountyRecords[i];
this.cbCountyDefault.Items.Add(objRecord);
}
this.cbCountyDefault.SelectedIndex = 0;
this.cbCountyDefault.EndUpdate();
MessageBox.Show(cbCountyDefault.SelectedItem.ToString());
MessageBox.Show(((GASTCountyRecord)this.cbCountyDefault.SelectedItem).ToString()); the first messagebox shows the objects name, and the one where i cast it shows the corect name..
the listing in the combobox lists the class name because it populates this by calling Object.ToString() not by casting it to my object type then calling ToString() .. any other suggestions?
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
hrm.. it was how i was doing it.. ill put this here for future reference
how not to do it:
public class GASTCountyRecord : object
{
public string m_strCode;
public string m_strName;
public GASTCountyRecord(string strCode, string strName)
{
m_strCode = strCode;
m_strName = strName;
}
public string ToString()
{ return m_strName; }
}
how to do it:
public class GASTCountyRecord : object
{
public string m_strCode;
public string m_strName;
public GASTCountyRecord(string strCode, string strName)
{
m_strCode = strCode;
m_strName = strName;
}
public override string ToString()
{ return m_strName; }
}
thanks for all your help.. i think the way they have you implement this is a bit wack tho
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hi.
WYSIWYG HTML Editors for webbased content managment systems have been around quite some time now. Personaly i love the free ASP.NET web control named "FreeTextBox", witch can be found at: SourceForge[^].
These days when more and more developers keep focusing on the power of the rich client, a HTML Editor Control for windows forms would be greate.
I was wondering if there where such a control around, where you could set up your buttons (witch type of HTML you would allow the user to create) and simply extract the html content. Are there inbuilt functions doing this in the RitchTextBox control?
-Jonas
|
|
|
|
|
Hello,I have got the appletElement by following:
mshtml.HTMLObjectElementClass applet=(mshtml.HTMLObjectElementClass)applets.item(i,i);
string altHtml=applet.altHtml;
to extract all anchors from the applet, a way is to process altHtml,I wonder whether has another way.
Thanks.;)
|
|
|
|
|
How do I detect when a dail up (or some other form of internet) connection is established?
|
|
|
|
|
I don't know the .NET BCL way to do it, but you could use InternetGetConnectedState[^] API. You can use it to find out whether you're connected, and what type of connection is currently being used (dial-up, LAN, whatever).
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
As part of my app, i've used reflection to load an assembly.
Assembly.LoadFrom(filename);
This works great. But I don't want the assembly to be bound any longer. I wish to modify/move/delete the assembly from the app. but now its bound and can't be modified.
Is there a way to 'unbind' an assembly?
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
You would have to load it in a separate AppDomain. Then when you unload the AppDomain, it'll unload the Assembly.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Right, firstly thanks for replying, it seems like the right was of doing it and after a bit of MSDNing, i've come up with some AppDomain code.
AppDomain appd = AppDomain.CreateDomain("Plugins");
foreach(Plugin File.....)
{
Assembly a = appd.Load(fileName);
}
OK this isn't all the code but its the only code that is failing. Basically the appdomain isn't loading the files. It throws the following:
File or assembly name <path>\plugins\Plugin.dll, or one of its dependencies, was not found.
For each of the plugin files I try to load. Now when it was trying to load the files in the main appdomain, it loads them fine, but now after trying what you said, I can't get it to load them. They are not bound anywhere else and the full path is given to the appd.Load() method.
Any ideas?
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Look at my article on Plugin Automation, it will generate the necesary wrapper classes and Management classes for loading/unloading (note: not too handy when a plugin contains a form).
It will probably do exactly what you want to do
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
leppie wrote:
(note: not too handy when a plugin contains a form).
His plugins contain forms.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Is there any equivalent to the GetTextMetrics function in the .NET framework? I'm trying to find the height of a font (I know I can use the Height property of a Font object) including the leading, which the height property doesn't give. If there is no equivalent could someone post an example of how to use GetTextMetrics in C#.
Thanks all!
- monrobot13
|
|
|
|
|
|
David Stone wrote:
System.Drawing.Graphics.MeasureString()
Thanks, but that doesn't work. It gives the exact same value as using the Height property of the font. I think I'm going to have to end up using GetTextMetrics, but I don't know how to create the TEXTMETRICS structure that it needs in C#.
Any help is much appreciated.
|
|
|
|
|
I have the class MyText devived from RichTextEdit and I have inside and an other structure (System.Collection.ArrayList).
In the main form I open a TabControl and like pages I use this class .
In the new class I draw ellipses .When the TabPage lose the focus the draw disapear . I override OnPaint , where I redraw everything , but this override is not doing what is meent to do .
Hwo I make the drawing to be seen on screen (ClientRectangle).
|
|
|
|
|
Save it as a picture in the richedit box?
jhaga
|
|
|
|
|
I cant do that because My project consist in a nomber unknown the ellipses
and the I whant to add others .
Thanks
|
|
|
|
|
tried using tapPage.Hide() but it has no effect, tab page still displays... I'm wanting to show a tabPage2 only when there are processing errors on tabPag1. Is there another way, or a way to dynamically add a tab page to a tab control...???
thanks,
vince
|
|
|
|
|
If the TabControl is named "tabControl" , the code for closing is :
// verify if the TabPages exist
// if we try to close a non-open tab will have error's
if (this.tabControl.TabPages.Count != 0)
this.tabControl.TabPages.Remove(this.tabControl.SelectedTab);
//SelectedTab is the selected tab tabControl.TabPages[<number>] is the
//<number> tab , if you whant other tab
|
|
|
|
|
thanks for the reply, but that's not quite what I'm looking for... I need to have either a hidden tab page that can be unhidden, or the ability to create a tab page with a listbox containing error strings...
Don't need to remove a tab page...
thanks for any further suggestions..
|
|
|
|
|
vlusardi wrote:
or a way to dynamically add a tab page to a tab control...???
Sure, try something like this, it works:
for(int i = 0; i < 5;i++)
{
TabPage tbpage = new TabPage("test" + i);
this.tabControl1.TabPages.Add(tbpage);
}
-Nick Parker
|
|
|
|