|
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!
|
|
|
|
|
Follow these steps:
*Make the constructor private like this:
private MainForm()
{
}
*Declare a static variable to hold the one-and-only form instance like this:
static MainForm instMainForm=new MainForm();
*Create a property procedure like this:
public static MainForm TheForm {
get {
return instMainForm;
}
}
*To get the form instance, call the "TheForm" property procedure.
"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
|
|
|
|
|
Hi!
The normal call
x = Shell("Rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl ,0")
How can this be done in C#
Thanx in Advance.
|
|
|
|
|
System.Diagnostics.Process.Start(...)
|
|
|
|
|
Its a bit more complicated but here is an example:
using System;
using System.Diagnostics;
Process p = new Process();
p.StartInfo = new ProcessStartInfo(@"Rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl, 0");
p.StartInfo.UseShellExecute = true;
p.Start();
p.WaitForExit();
Andy
He who knows and knows that he knows, is wise; follow him
He who knows and knows not that he knows, is asleep; wake him
He who knows not, and knows that he knows not, is simple; teach him
He whoe knows not and knows not that he knows not, is a fool; kick him
|
|
|
|
|
Thank you both )
|
|
|
|
|
Thanx but both the solutions gives errors.
System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at TestWindowsForms.Form1.menuItem24_Click(Object sender, EventArgs e) in d:\visual studio projects\art\testwindowsforms\form1.cs:line 661
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Yes I've check the command " Rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl, 0 " inside the Start/Run dialog in windows 2000 and it works.
But why doesn't it work when called from the program. Check with other *.cpl files as well.
Any help would be Greatly appreciated !!!
|
|
|
|