|
Solution de Uberness:
-----------------------------------------------
using System;
namespace UberControls
{
public class TreeViewNonExpanding : System.Windows.Forms.TreeView
{
private bool incomingDoubleClick = false;
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch( m.Msg )
{
case 0x0203: // WM_LBUTTONDBLCLK
this.incomingDoubleClick = true;
break;
case 0x0202: // WM_LBUTTONUP
this.incomingDoubleClick = false;
break;
default:
break;
}
base.WndProc (ref m);
}
protected override void OnBeforeExpand(System.Windows.Forms.TreeViewCancelEventArgs e)
{
if( incomingDoubleClick == true )
e.Cancel = true;
base.OnBeforeExpand (e);
}
}
}
|
|
|
|
|
I have designed a .Net web service and the client is requesting a new web method to return the web service version number? My web service code consists of the following:
<br />
<WebMethod(Description:="Get Web Service Version Number.")> _<br />
Public Function GetVersion() As String<br />
Dim sValue As String<br />
sValue = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()<br />
Return sValue<br />
End Function<br />
The problem is this returns “0.0.0.0”. I have tried the following in the assembily.vb file with no luck:
<br />
'<Assembly: AssemblyVersion("1.0.*")> <br />
<Assembly: AssemblyVersion("*")> <br />
Can anyone tell me what I’m doing wrong.
Thanks,
Jason W.
|
|
|
|
|
The code you have should work perfectly. AssemblyVersion("*") isn't valid however. I actually got a compiler error when I tried to use it.
The asterisk in the default tells the compiler to automatically increment the version as you build..
1.0.4.3333
1.0.4.3334
...etc...
Use AssemblyVersion("1.0.*") or specify the full version ("1.0.0.0")
If you debug your web service, do you also see 0.0.0.0 returned to string sValue?
|
|
|
|
|
Now why didn’t that work the other day? It works now. Thanks for the help.
Jason W.
|
|
|
|
|
Hi!
The point is that while scrolling within a datagrid, sometimes the gridloses focus with no reason because I was just scrolling.The class below simply illustrates this(while scrolling you'll get a message)
Thank you in advance.
ps: I'm using vs.net 2003.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace test2k3
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dg;
private DataTable dt;
private System.Windows.Forms.Button button1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
dt = new DataTable();
DataColumn dc = new DataColumn("Nr");
dt.Columns.Add(dc);
for(int i = 0 ; i < 100; i++)
{
DataRow dr = dt.NewRow();
dr[0] = "row #"+i;
dt.Rows.Add(dr);
}
this.dg.DataSource = dt;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.dg = new System.Windows.Forms.DataGrid();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit();
this.SuspendLayout();
//
// dg
//
this.dg.DataMember = "";
this.dg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dg.Location = new System.Drawing.Point(24, 16);
this.dg.Name = "dg";
this.dg.Size = new System.Drawing.Size(160, 128);
this.dg.TabIndex = 0;
this.dg.Leave += new System.EventHandler(this.dg_Leave);
//
// button1
//
this.button1.Location = new System.Drawing.Point(232, 64);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 32);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(328, 173);
this.Controls.Add(this.button1);
this.Controls.Add(this.dg);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dg)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void dg_Leave(object sender, System.EventArgs e)
{
MessageBox.Show("You haven't leaved the grid.You've been just scrolling!","Is This A Bug?");
}
}
|
|
|
|
|
More specifically, the .Leave event is fired when the currently selected cell is scrolled out of view (up or down). Curiously, no Enter event is fired when it is scrolled back in view but a Leave *will* be fired again if you continue scrolling. And in neither case is Got/LostFocus() fired.
I don't usually like to call things bugs in frameworks like this as I usually find the reason or solution as soon as I do.
Depending on what you want to do when focus is lost and gained, I think you can find a pattern of events to identify this situation.
For example, clicking between cells causes: GotFocus, CurrentCellChanged, LostFocus
However in the scrolling scenario: Leave, Validating, Validated
|
|
|
|
|
am i write to say that .NET does not provide any library to directly access any system device. if yes, can anyone tell me how can i access hardware devices using WMI (Windows Management Instrumentation). a short example would be nice.
|
|
|
|
|
before asking this kind of question why don;t you search the site!!!!
just type WMI into the textbox at the top of the page...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
actually i did but all in vain. every example posted in WMI articles are not about peripherals like sound devices, video cameras or even scanners....
i thought maybe anyone have had worked in this particular case!
|
|
|
|
|
In version 6.0 I could right click and delete, now I can only add????
|
|
|
|
|
To be honest, I never use the Class Viewer - working directly in Solution Explorer. From Solution Explorer, you can delete files, and assuming you follow standard practice of 1 class per file, this should do the same thing.
|
|
|
|
|
Thanks, I finally saw that. The "file view" magically re-appeared.
|
|
|
|
|
I have application with header and detail. I browse the data both with datagrid. In datagrid parent i have some trouble, it is display plus (+) sign because the datasource for this grid have relation. I dont want to remove this relation. How to invisible this sign Thx.
|
|
|
|
|
Does anyone know of a way to dynamically determine which server to use a web service from.
I basically want to be able to change a registry setting and switch web servers should one fail.
Think .NET Reflection is likely to a part of the solution??
Thanks in advance,
Andrew
|
|
|
|
|
There is a Url property to a Web Service.
localhost.Service1 tService = new localhost.Service1();
tService.Url = "http://www.GoThere.com/Service1/";
|
|
|
|
|
How to shutdown windows from vb .net application thx
|
|
|
|
|
You can use the ExitWindowsEx[^] method, but remember, on Win2000/XP you'll need extra privileges to use it.
|
|
|
|
|
What is the extra privileges for window XP? I use this but it does not work. Thx
|
|
|
|
|
In VB5 is was
Shell "RUNDLL32.EXE user,ExitWindows"
so it should be
System.Diagnostics.Process.Start("RUNDLL32.EXE user,ExitWindows");
in VB.NET
|
|
|
|
|
I already use this code, but it is error "Can not find file" How about it? thx
|
|
|
|
|
Here's code that'll do it in C#. This includes the code to temporarily elevate the process' privileges so that it is allowed to shut down the system. (ExitWindowsEx will fail on WinNT/2K/XP if you don't elevate the process' privileges before calling it).
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
Here's code that'll do it in C#. This includes the code to temporarily elevate the process' privileges so that it is allowed to shut down the system. (ExitWindowsEx will fail on WinNT/2K/XP if you don't elevate the process' privileges before calling it).
link to google group message
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
Hello...
For some strange reason, several of the forms in my vb.net app no longer open up in form design mode. They only open up in the code view. Is there any way to change this back??
thanks
- dw
|
|
|
|
|
Every form file, has a resx counterpart. Try deleteing the resx file and opena the form file again.
Free your mind...
|
|
|
|
|
Would anybody be interested in a sample Programe for NET Framework.Compact (VS 2003) with a DateTimePicker ?
The source is based on C# Code found on there Server, but with Internalation support.
At the moment it cannot do two things :
- set the first day of the week (allways Sunday)
- automaticlly translate the word "Today".
The month picker supports all Maschine date formats.
The Day of Week and Month show local language.
Adding a new language takes 3 lines of code.
German and English are supported for the "Today".
Mail here or to mj10777@mj10777.de
Mark Johnson
|
|
|
|