|
If ListView.HideSelection is set to false (default), the gray background is not drawn when an item is selected and the ListView does not have the focus.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Okay but it needs to be focus becourse this item i select will display info about it self in a label.
When i moves the mouse pointer over the items, the label folows the mouse and display the item. but if i click on an item then the label will dispare, and the selected item will be gray.
I whant to change so the selected color is not gray, i most have the slect mothod becourse i have a drag and drop on this items.
I want also that the label will be shown even when i click on an item.
//Jimmy
|
|
|
|
|
So set the focus to the ListView using the Focus method. The gray is because the ListView doesn't have focus when you programmatically select an item. The item is still selected even if HideSelection is true , it just doesn't show a background (i.e., it's "transparent"). You really should read the ListView class documentation for these properties and methods, and should for the rest as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can i call a Java code from C# code
|
|
|
|
|
Yes, but not easily. One way is through JNI (Java Native Interfaces), which I discuss in my article Hosting .NET Controls in Java[^] (and older article is posted here on CodeProject but doesn't include Java-calling code like the article above does).
There are also many products out there that generate proxies that allow you to call these directly. There's another article at DevX about some products, Calling Java Classes Directly from .NET[^].
A quick search on google would've turned up these and many others.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
table containing two fields one is code and another is name. i need to fetch repeated names only.(more than one occurance of name and code is not same). any one help to me. thanks in advance.
Have A Nice Day!
Murali.M
Have A Nice Day!
Murali.M
|
|
|
|
|
How about this: SELECT code, name FROM table GROUP BY code, name HAVING COUNT(*) >= 2
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Ooops, sorry, I didn't notice that you posted this in three different forums and already received a response.
Oh, and SQL questions should, by and large, be submitted in the SQL forum.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Can C# Control Serial Port?
Which class in .NET Framework is for SerialPort Communicate Programming?
thanks a lot.
|
|
|
|
|
For low level communication you can write to the virtual file "COM1".
|
|
|
|
|
Dear Corinna John
Can you explain for detail how to write to the virtual file "COM1"
in c#?
Thanks a lot!
|
|
|
|
|
Usually you open a file with the name of the serial port (COM[x]). The file doesn't exist in the file system. Whatever you write to the "file" will be sent to the serial port, messages from the device can be read from that virtual file.
FileStream fs = new FileStream("COM1", FileMode.OpenOrCreate);<br />
fs.Write(...);<br />
fs.Flush();<br />
It worked with other languages, I think it should also work with .NET
|
|
|
|
|
Can you do that with (LPT1)?
/\ |_ E X E GG
|
|
|
|
|
As far as I know, you can do that with every port.
|
|
|
|
|
Hi there
I want to open a child form from a dialog form (.ShowDialog)
and after the child form shows i want to close the dialog form.
In the Dialog form there are 2 buttons:
1) btnclose which closes the dialog form
2) btnOpenChild which opens a child form and then closes itself (the dialog form)
What should i do to get my desired result?
I have included the codes to all the forms so that it may
become easier to understand what i want to do.
I am a total newbie, so plz do bare with me!
Any help will be gr8!
Thanks in Advance
VisionTec
******************************
Form1 ( Main MDI Parent Form )
******************************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnChild;
private System.Windows.Forms.Button btnDialog;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.btnChild = new System.Windows.Forms.Button();
this.btnDialog = new System.Windows.Forms.Button();
this.SuspendLayout();
this.btnChild.Location = new System.Drawing.Point(72, 112);
this.btnChild.Name = "btnChild";
this.btnChild.TabIndex = 1;
this.btnChild.Text = "open child";
this.btnChild.Click += new System.EventHandler(this.btnChild_Click);
this.btnDialog.Location = new System.Drawing.Point(208, 112);
this.btnDialog.Name = "btnDialog";
this.btnDialog.TabIndex = 2;
this.btnDialog.Text = "open dialog";
this.btnDialog.Click += new System.EventHandler(this.btnDialog_Click);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(408, 413);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btnDialog,
this.btnChild});
this.IsMdiContainer = true;
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void btnChild_Click(object sender, System.EventArgs e)
{
WindowsApplication1.frmChild child = new WindowsApplication1.frmChild(this);
child.Show();
}
private void btnDialog_Click(object sender, System.EventArgs e)
{
WindowsApplication1.frmDialog dialog = new WindowsApplication1.frmDialog();
dialog.ShowDialog();
}
}
}
*************************
frmDialog ( Dialog Form )
*************************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication1
{
public class frmDialog : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnOpenChild;
private System.ComponentModel.Container components = null;
public frmDialog()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.btnClose = new System.Windows.Forms.Button();
this.btnOpenChild = new System.Windows.Forms.Button();
this.SuspendLayout();
this.btnClose.Location = new System.Drawing.Point(32, 96);
this.btnClose.Name = "btnClose";
this.btnClose.TabIndex = 0;
this.btnClose.Text = "Close";
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
this.btnOpenChild.Location = new System.Drawing.Point(152, 96);
this.btnOpenChild.Name = "btnOpenChild";
this.btnOpenChild.TabIndex = 1;
this.btnOpenChild.Text = "open child";
this.btnOpenChild.Click += new System.EventHandler(this.btnOpenChild_Click);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btnOpenChild,
this.btnClose});
this.Name = "frmDialog";
this.Text = "frmDialog";
this.ResumeLayout(false);
}
#endregion
private void btnClose_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void btnOpenChild_Click(object sender, System.EventArgs e)
{
}
}
}
***********************
frmChild ( child form )
***********************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication1
{
public class frmChild : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public frmChild(WindowsApplication1.Form1 parent)
{
InitializeComponent();
this.MdiParent = parent;
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "frmChild";
}
#endregion
}
}
}
|
|
|
|
|
Well...I could not get your stuff to run (I think you forgot to paste the InitializeComponent() methods), so take this all with a grain of salt.
You could just handle the closed event on your dialog form. Change / add this to form1
private void button2_Click(object sender, System.EventArgs e)
{
WindowsApplication1.frmDialog dialog = new WindowsApplication1.frmDialog();
dialog.Closed += new EventHandler (vShowChild);
dialog.ShowDialog();
}
private void vShowChild(object sender, EventArgs e)
{
WindowsApplication1.frmChild child = new WindowsApplication1.frmChild(this);
child.Show();
}
Then just close the dialog:
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}
Hope this helps,
Bill
|
|
|
|
|
Hi there
Thanks for the help
but i actually want the child form to load
when the user wants it to.
so i have added another button to the Dialog form.
i have updated the code on the discussions board
and also uploaded the source code to my website:
http://www.geocities.com/talhatec/downloads/WindowsApplication1.cab[^]
the code is only 14K
plz help me once again!
VisionTec ( TEC )
|
|
|
|
|
|
i am using Linux and i want to ask how can i record the sound from sound card, say 5 seconds, by using C.
is there a major difference between C and C#
suki
|
|
|
|
|
Yes. Not only are they different languagues, they run on entirely different runtimes. Currently, C# (and all .NET, since all .NET languages compile down to Intermediate Language (IL)) is barely supported on linux through the Mono project.
For more information about .NET and what you can't do on linux, see http://msdn.microsoft.com/netframework/[^].
And if you tried this in Windows, you'd best try Managed DirectX and the Microsoft.DirectX.DirectSound.Capture class.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Eos is an aspect-oriented extension for C# similar to AspectJ for Java. The compiler support is in preliminary stage now. Eos version 0.2-Beta was released recently and more mature versions are expected soon. Eos is available from http://www.cs.virginia.edu/~eos [^]
|
|
|
|
|
We have an interesting, but perhaps not uncommon, system integration and architectural challenge, since our principle line-of-business application runs on a mainframe (“zSeries” it’s called these days) hosted, supported and controlled by our biggest vendor. So, we connect to the application using 3270 terminal emulation (“Rumba”) that connects through Microsoft SNA, er…, Host Integration Server. Plus, since it is 3270 through SNA, TN3270 isn’t an option, either. We have no direct control over things that run on the mainframe, i.e., we cannot run APPC programs or execute CICS jobs. We can only choose menu options and enter characters on existing screens. So, I want to be able to do that automatically.
And, I’ve been doing research. I’ve found stuff about HLLAPI and WinHLLAPI. Neither of these sounds very robust (Daniel Turini posted a response about those alternatives to someone else’s inquiry about screen scraping here on CP). I’ve found several vendors (SDI, ClientSoft, NetManage, Zephyr Corp) who offer expensive legacy application/host integration packages that sound like they’ll do the job, but the prices are pretty high.
So, what I’d like to know is: 1) if you confronted such a challenge on a project, what solution did you use? 2) how has that solution worked out? 3) if there is a low-cost, non-proprietry solution, what is it and are there code samples? Your insights and experience are appreciated.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Hi Guys,
I have a problem regarding postback. I hid the <input type=file>
html control named myFileBrowser and simulated a click event to this
html control using javascript. After selecting a file in the Open
file dialog, i copied the contents of the file html control into
another input box named dummyfile. However, I noticed that I had to
click the <asp:Button> (named Button1) twice before I get a
load/postback event in my c# code. I placed a breakpoint in the
Page_Load method of my c# code to check this. I also tried
submitting the form (named Form1) in the javascript part right after
copying the contents of myFileBrowser to dummyfile, but it
complained of an error. The error was "Access Denied" with Code = 0.
Can anybody help me regarding this problem? Been stuck with this for
a long while now. The code is below for your reference.
Many thanks in advance.
-Chris
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<p>File Name: <input id="myFileBrowser"
style="DISPLAY: none" type="file" size="60" name="filAttachment"
runat="server">
<input id="dummyfile" type="text"
onchange="document.getElementById('myFileBrowser').value =
this.value;"
size="60"> <input
onclick="document.getElementById('myFileBrowser').click();
document.getElementById('dummyfile').value = document.getElementById
('myFileBrowser').value; return false;"
type="image" height="20"
width="40" src="file:///C:\Inetpub\wwwroot\_imgs\btn_off_cal.gif"
name="browse">
</p>
<input id="btnOk" title="Ok" type="button"
value="Ok" name="btnOk" runat="server">
<input id="btnCancel" title="Cancel"
onclick="doOnCancel()" type="button" value="Cancel"
name="btnCancel">
<asp:Button id="Button1" style="Z-INDEX:
101; LEFT: 344px; POSITION: absolute; TOP: 152px" runat="server"
Text="Post Back"></asp:Button></form>
</body>
|
|
|
|
|
c cochran wrote:
Can anybody help me regarding this problem?
Try the ASP.NET[^] forums.
- Nick Parker My Blog
|
|
|
|
|
Hi,
How do I add a "Minimize to tray" button in the title bar of a form?
Thanks,
Josef
|
|
|
|
|