|
THanks... all I need was to know how to open the about form. thanks again.
/\ |_ E X E GG
|
|
|
|
|
if i lauch a child form from the main one like this:
FormOpen dlg = new FormOpen();
if (dlg.ShowDialog() == DialogResult.OK)
{
// stuff
}
how can FormOpen class gain access to member variables of the main form?
is there a method like AfxGetApp() for getting a ref to the main form?
|
|
|
|
|
You could just create a constructor for FormOpen that takes a form. That way you could just do:
FormOpen dlg = new FormOpen(this);
Then you can use the mainform just like any other object in your form.
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
While creating a web component I ran into a problem with setting the properties for the Designer Property Pages.
One of my Properties can only be Top,Bottom,Left, or Right.
I want these in a listbox on the property pages. I have hunted for a way to do this, but I have been unable to find anything remotely close to the subject.
|
|
|
|
|
draco_iii wrote:
I want these in a listbox on the property pages. I have hunted for a way to do this, but I have been unable to find anything remotely close to the subject.
All you should have to do is make sure your property is defined as an Enum then the property grid will take it from there.
class MyClass
{
public enum Sides
{
Top, Bottom, Left, Right
}
private Sides sides;
....
[Browsable(true)]
public Sides Sides
{
get
{
return sides;
}
set
{
sides = value;
}
}
...
} Maybe I just didn't understand the question, because it sounds like you have something similar to this already.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
I wanted to thank you so very much. That was right on target, I had something very similar, but was missing the "enum" contructions that allowed it to work properly.
Again, thank you very much, I searched for hours yesterday, but to no avail.
|
|
|
|
|
Hi!
I want to create my own control to display icons of images. My control inherits from a listbox. One row of images belongs to a group. How can I force C# to use a fixed number of columns for the items of a listbox?
Thanks
Jimmy
|
|
|
|
|
Can anyone point me in the right direction to take a group of files and ZIP them together? I am not looking for a component ... there should be something built into the .NET Framework for file compression, right?
I am struggling at finding information ... please help.
Wally Atkins Newport News, VA, USA
|
|
|
|
|
There are no compression streams built into the .NET framework. If you are looking to just combine the files into one big file, then you can just open each file and copy the bytes from them into one file. You will need to do something so that you can tell when one stops though and another begins.
Hope this helps,
Nathan
P.S. I do know of a library for .NET compression but you said you don't want it.
D2F3U wrote:
I am not looking for a component ...
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Take a look at this GPL (open-source) zip library, called SharpZipLib[^].
"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
|
|
|
|
|
Heh, that's where I would've sent him had he asked for it... Maybe I took his quote about not wanting a component to literally. But SharpZipLib is a great library...
anyway, I think I am too bored, cause I am posting this useless message...
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Hi, i need to create a listbox from a database, which should display the name of a field and have the row id hidden, that i can "see" to manipulate the database table.
|
|
|
|
|
There are a few ways of going about this, one is with a DataSet/DataTable the other is using a custom class.
With a DataSet:
Set the listbox's DisplayMember and ValueMember properties to the name of the fields in the DataTable (if using a DataSet prefix them with the name of the table), then set the DataSource property to the instance of the DataSet or DataTable . With a custom class:
First define your custom class
public class MyData
{
private int id;
public string theField;
public MyData(int id, string theField)
{
this.id = id;
this.theField = theField;
}
public int ID
{
get { return id; }
}
public string TheField
{
get { return theField; }
set { theField = value; }
}
} Now on the ListBox , set the ValueMember to "ID" and the DisplayMember to "TheField". Once you have a collection of MyData objects (an Array or ArrayList or something that implements IList which returns instances of MyData ) assign that collection to the DataSource property of the ListBox.
MyData [] data = new MyData[3];
data[0] = new MyData(0, "Huey");
data[1] = new MyData(1, "Dewy");
data[2] = new MyData(2, "Louie");
myListBox.DisplayMember = "TheField";
myListBox.ValueMember = "ID";
myListBox.DataSource = data; HTH,
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
hi,
if i understand this rigth in a listbox i can have a field to be displayed and a value "linked" to that field.
what i did was:
public class BaseDados
{
public DataTable doquery(string query)
{
OleDbDataAdapter DataAdapter = new OleDbDataAdapter(query, connectionString);
DataSet dataSet = new DataSet();
DataAdapter.Fill(dataSet, "Same");
DataTable dataTable = dataSet.Tables[0];
return dataTable;
}
}
and in the class of the form where is my listbox i put:
BaseDados db = new BaseDados();
DataTable table = db.doquery("Select * from autenticacao");
listBoxOrigem.DisplayMember = "email";
listBoxOrigem.ValueMember = "id";
listBoxOrigem.DataSource = table;
|
|
|
|
|
viana wrote:
if i understand this rigth in a listbox i can have a field to be displayed and a value "linked" to that field.
I think you got it
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
hi,
if i understand this rigth in a listbox i can have a field to be displayed and a value "linked" to that field.
what i did was:
public class BaseDados
{
public DataTable doquery(string query)
{
OleDbDataAdapter DataAdapter = new OleDbDataAdapter(query, connectionString);
DataSet dataSet = new DataSet();
DataAdapter.Fill(dataSet, "Same");
DataTable dataTable = dataSet.Tables[0];
return dataTable;
}
}
and in the class of the form where is my listbox i put:
BaseDados db = new BaseDados();
DataTable table = db.doquery("Select * from autenticacao");
listBoxOrigem.DisplayMember = "email";
listBoxOrigem.ValueMember = "id";
listBoxOrigem.DataSource = table;
and it display the field email correctly.
How can i read the selected item from my listbox, the id
i tried:
string b=listBoxOrigem.SelectedItem.ToString();
but it did't work
|
|
|
|
|
I thought it was odd you'd put all of that in a reply just to say you have it right
viana wrote:
How can i read the selected item from my listbox, the id
string b = listBoxOrigem.SelectedValue.ToString();
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Hey All,
I have an application that has a main form, which is a mdi container. Docked in the left side of the container is a treeview control. In the open space on the right side of the container I load various forms based on what the user clicks on in the tree view control. Now these forms have no borders, and are not resizable, they are made to fit exactly in the space left between the right side of the container and the tree view control. Here is my problem, I start by getting rid of whatever form is in the space initially, if there is one, and i use the show method, with various property settings to dock it. But when it loads the form, you see a flash of the form your loading with a border and not docked. Then it shows the form correctly. But this "flash" of the form before its docked is really annoying. I was wondering if anyone knew of a way to get rid of this flash of the form im loading.
Thanks,
Ryan
P.S. Here is a clip of the code if its helpful.
m_cCurrent = frmCurrent;
m_cCurrent.FormBorderStyle = FormBorderStyle.None;
m_cCurrent.Height = 422;
m_cCurrent.Width = 576;
m_cCurrent.MdiParent = this;
m_cCurrent.Dock = DockStyle.Right;
m_cCurrent.SetDelegates(m_dlgNotifyMain);
m_cCurrent.Show();
m_aForms.Add(m_cCurrent);
m_iIndex ++;
|
|
|
|
|
Keep it invisible until you've finished all that stuff.
"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
|
|
|
|
|
yea i tried that, didnt work, thanks for the suggestion.
Ryan
|
|
|
|
|
I am trying to sink element events. I have successfully done this with
the browser and the document events. When I do the following
UCOMIConnectionPointContainer pConPtCon =
(UCOMIConnectionPointContainer)obj.srcElement;
Guid guid = typeof(mshtml.HTMLSelectElementEvents2).GUID;
UCOMIConnectionPoint pConPt;
pConPtCon.FindConnectionPoint(ref guid,out pConPt);
selectelementEvents = new IEHTMLSelectElementEvents();
pConPt.Advise(selectElementCookie,out elementCookie);
No exceptions are thrown, but i receive none of the event
notifications.
when i do the following
obj.srcElement.ondragstart += new
mshtml.HTMLElementEvents2_ondragstartEventHandler(ondragstart);
I receive the first notification and from then on, I am unable to
resize, drag or do anything to the element. I need to be able to sink
elements as they are created in order to get their resize
notifications.
Has anyone else had any similar problems or know of any solutions.
Thanks,
Scoop
"Never trust a man who, when left alone with a tea cosy, doesn't try it on!"
|
|
|
|
|
Scoop wrote:
I receive the first notification and from then on, I am unable to
resize, drag or do anything to the element
Be sure to return either true or false in the ondragstart eventhandler to cancel/allow event bubbling, depending on your application needs.
|
|
|
|
|
public bool onmovestart(mshtml.IHTMLEventObj obj)
{
return true;
}
I am returning true. The problem is that if i do this, i get the movestart event, but nothing more and i am not allowed to move,drag etc the control!
Scoop
|
|
|
|
|
Hi !
I use the object create my own web browser.
private AxSHDocVw.AxWebBrowser instVisualObjectCreator;
then by using instVisualObjectCreator.Navigate(); I show it inside my client form.
But can i use this facility (instVisualObjectCreator object) to get the source of the web page. Is there a method to get the source code from this object. I've gone through the documentation but somehow the solution has illuded me.
Thanx in Advance
|
|
|
|
|
using System.Runtime.InteropServices;
IHTMLDocument2 doc = (IHTMLDocument2) instVisualObjectCreator.Document;
UCOMIPersistFile pf = (UCOMIPersistFile) doc;
pf.Save(@"c:\myhtmlpage.html",true);
PS : the IHTMLDocument2 interface is from the mshtml primary interop library (which you can add to your project, c:\program files\microsoft.NET\primary interop assemblies\microsoft.mshtml.dll).
|
|
|
|