|
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).
|
|
|
|
|
Or he could do it the "Completely managed" way:
using System;
using System.Net;
using System.Text;
namespace Utilities
{
class WebPage
{
static string GetHtml(string address)
{
WebClient client = new WebClient();
return Encoding.Default.GetString(client.DownloadData(address));
}
}
}
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
|
|
|
|
|
Geeee! This is ok for a completely IE-less scenario.
|
|
|
|
|
Yeah. That was my point. Why on earth would you need to use IE?
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
|
|
|
|
|
Well, I guess that saving the html source code from the current web page is the final scenario step for Windows apps that embed IE because they want to show the web page(s). The .NET WebClient helper class is no substitution for showing pages.
|
|
|
|
|
Ah...I see now. I didn't think of it in terms of actually showing pages...just downloading them and parsing their source (which I've done a lot of recently).
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
|
|
|
|
|
How can I install a service PROGRAMICALLY?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
|
|
I'm having some problems creating only a single instance in a document view in a MDI. So, regardless of the user's interaction with the new form command only 1 form will be shown.
If anyone has an idea, please let me know. Thanks!
|
|
|
|