|
Your Closing event will have a parameter of type CancelEventArgs which has a property called Cancel . Set the property Cancel to true and the application won't exit.
This gives you a chance to pop up a message box asking "Are you sure?" and if the user selects "no" then you can cancel the event. If the user selectes "yes" then you need do nothing more - the application will be closed.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Thanks!!!
e.Cancel = true;
It is exactly what I need.
Thank you for fast answer.
Regards
Kamil
|
|
|
|
|
I'm not sure how to do it!
help pls
Cata
|
|
|
|
|
See the StringFormat class. OR StringFormatFlags.NoWrap with StringFormat.FormatFlags and pass the StringFormat instance to your Graphics.DrawString call.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi ,
i have a mesh model and i put it in many places in my app. using the world transformation and i want to detect which mesh is the pointed one but when i point to mesh it only detects the last mesh has been transformed .
|
|
|
|
|
What do you mean by "the pointed one"? This is a little too non-technical to answer.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i mean by it the one which the mouse points to it
|
|
|
|
|
You can get the mouse position at any time using the static Control.MousePosition property. You could transform these coordinates to your world space and get the mesh you need, or if you click on it you can get the client coordinates and transform these.
When you say you are getting the last mesh that was rendered, do you mean that you're destroying and re-creating your mesh with each drawing phase, and that you get the last one rendered? You probably don't need to destroy your mesh each time, though you would have to get the materials and textures from it to draw.
I'm sorry if I don't understand your problem.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Contact your administrator, and ask him if he could add you to the debug users group ...
DOn't know why this is good either
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
jithen_dt wrote:
why should I have admin rights?
Microsoft's IDE wrote:
Access is denied. Verify that you are an administrator or a member of the 'Debugger Users' group on the machine you are trying to debug.
Well, that says to me that you either need to be an Administrator (because they can do anything) or a member of the debugger group (because that's what you are trying to do)
So, add yourself to the debugger group and log in again. If you still get the message then you probably do need admin rights.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
I want to make use of dlls created in .Net in vb6 is
it possible
Every thing is MAYA
|
|
|
|
|
Yes, so long as they expose CCWs, or COM-Callable Wrappers (which is the best way, and VB6 is entirely built on OLE/COM anyway). See Nick's article, Creating a CCW for COM-enabled, non-.NET Applications[^], and read Exposing .NET Framework Components to COM[^] in the .NET Framework SDK.
A few important things to note: explicitly define your class and interfaces GUIDs (using the GuidAttribute ), and DO NOT use auto-generated class interfaces. Instead, attribute your class with ClassInterface(ClassInterfaceType.None) and explicitly declare your class interface and implement it as the first interface in the list of interfaces. Make sure you declare your interface as an automation interface by attributing your interface with InterfaceType(ComInterfaceType.InterfaceIsIDispatch) (or ComInterfaceType.InterfaceIsDual ). Since VB6 depends on automation, declaring your interface as an IUnknown implementation won't work.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yes. You'll need to use regasm.exe to register your assembly as a COM dll. Depending on what the public interface looks like you might have to decorate your code with attributes. There is a lot of information and examples on the web. You can also take advantage of COM+ services in the System.EnterpriseServices namespace.
|
|
|
|
|
Hello,
I have many servers running on different machines.
My client program will be shown a list box of available servers.
When connection to server is to be done .NET Remoting.
Now, I should continuosly check whether the connected server is still
running and check all the available servers status and delete the
server from the list if it is not running.
How can I do this, using .NET Framework?
|
|
|
|
|
If you remove it, then you'd have to keep a list elsewhere so that you can always add them later when they're up and running again. I'd just as well leave them in.
As far as checking their up-status, just try connecting to their published remoting objects that you need. If it fails, then the server's not "up". Simply pinging (which would require implementing ICMP or finding some third-party library that already has) them might not tell you enough, since many firewalls don't return pongs or reply with "destination unreachable". It's also possible that the remoting server (a Windows Services, IIS, whatever) is stopped but the server is up, so pinging it would be disjoint and wouldn't give you an accurate assessment of whether or not the remoting objects is available.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My problem is this, i have a stored procedure in oracle,
and i which authenticates a user on the basis of loginName
and password.
the problem is that when i accesssed it through C#
giving the two parameter as input and one parameter as output.
there is no value return in output parameter.
can some on tell me how to get the output parameter value in my code
Thanks In Advance
//------------- stored procedure name is
===========SecurityPkg.Authenticate=============
PROCEDURE Authenticate(loginName IN VARCHAR2,loginPassword IN VARCHAR2, loginResult OUT INT )
IS
objectId NUMBER := -1;
objectPwd VARCHAR2(100);
passwordExpiredDate DATE;
BEGIN
Select OBJECT_ID,PASSWORD,PASSWORD_EXPIRES INTO objectId,objectPwd,passwordExpiredDate
From Application_User
Where Application_User.Login_Name=loginName;
IF(objectId = -1) THEN
loginResult := ACCOUNT_DOESNOT_EXITS;
END IF;
IF(objectPwd != loginPassword) THEN
loginResult := WRONG_PASSWORD;
End if;
IF(passwordExpiredDate < SYSDATE) THEN
loginResult := PASSWORD_EXPIRED;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
loginResult := ACCOUNT_DOESNOT_EXITS;
END Authenticate;
//------------------- csharp code that access the above stored procedure of oracle
OracleCommand cmd=new OracleCommand();
cmd.CommandText="Security_Pkg.Authenticate";
cmd.Connection=myConnection;
cmd.CommandType=CommandType.StoredProcedure;
// first param
OracleParameter loginNameParam=new OracleParameter("loginName",OracleDbType.Varchar2);
loginNameParam.Direction=ParameterDirection.Input;
loginNameParam.Value="Ali";
// 2nd param
OracleParameter loginPasswordParam=new OracleParameter("loginPassword",OracleDbType.Varchar2);
loginPasswordParam.Direction=ParameterDirection.Input;
loginPasswordParam.Value="pass";
// 3rd param
OracleParameter loginResultParam=new OracleParameter("loginResult",OracleDbType.Int16);
loginResultParam.Direction=ParameterDirection.Output;
cmd.Parameters.Add(loginNameParam);
cmd.Parameters.Add(loginPasswordParam);
cmd.Parameters.Add(loginResultParam);
cmd.ExecuteNonQuery();
Now when i check the value of loginResultParam, its null.
can any one tell me how to get its value
|
|
|
|
|
It should work, according to the documentation. I've also done this many times using the SqlClient, which works similarily (from callers' perspectives). Have you tested your stored procedure using some Oracle command execution environment? I must admit that I don't know much about Oracle (for my own personal reasons) but I know that in SQL Server you have to declare the size of your char arrays, even for parameters declared in the stored procedure, as well as the size of them when declaring your parameters to use with ADO.NET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I believe that the problem lies in your PL/SQL code. The one thing that I notice is that you never assign a default value to the output parameter in your sproc. If none of the If conditions test true, then loginResult is returned with the database default value.
In my testing (VS.NET 2002, Oracle.DataAccess, Oracle 9i), the output parameter defaults to null regardless of data type declaration. By setting loginResult to your default success value before running the Select statement, you should get the desired result.
Hope that helps.
--Jesse
|
|
|
|
|
Try closing the connection object before you check the output parameter value. I haven't the faintest idea why, but with sql7.0 I get null for output parameters until after I call the close method on the connections...
Someone smarter than I will have to take a shot at why that might be...
Grasping...
Bill
|
|
|
|
|
need to open a form but it must be an MDIChild ie its menu bar needs to appear on the MDIparent any ideas
private void btnLogin_Click(object sender, System.EventArgs e)
{
if(CheckUser(txtUserName.Text,txtPassword.Text) == 1)
{
SalesForm frm = new SalesForm();
if(MdiParent != null)
{
MdiParent.AddOwnedForm(frm);
frm.Show();
this.Close();
}
}
else
{
throw new Exception("fart");
}
|
|
|
|
|
I'm not sure if this is what you want but check this out.
In your child form right click on the mainmenu that you have added.
Hit properties. Once you hit properties for the menu you will see
MergeType
click on this and then change it to MergeItems
This will append the menu to your parent's menu.
I hope this helps.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
The best way to handle this problem and doing it safely is to create a delegate in the Parent, create an Event in the child, and subscribe the delegate to the event. Then when your child sees that the event for opening the second child occurs, you raise the event and pass the necessary information to be passed to the second child in the event args.
...parent...
MyChild child;
...
if (child != null)
{
child = new MyChild();
child.SomeEvent += new EventHandler(myDelegateMethod);
child.MdiParent = this;
child.Show();
}
else
child.Focus();
...
private void myDelegateMethod(object sender, MyEventArgs e)
{
INewChild something;
if (e.RequestedForm == "Calculate")
something = new Calculate(e.Args);
else
something = new SomethingElse(e.Args);
something.MdiParent = this;
something.Show();
}
...
public class MyEventArgs:System.EventArgs
...
______________________________
The Tao gave birth to machine language. Machine language gave birth to the assembler.
The assembler gave birth to the compiler. Now there are ten thousand languages.
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
|
|
|
|
|
Is string a primitive type or is it not?
I read in Jeffrey Richter's "Applied Microsoft .NET Framework" that string (and decimal too) should be primitive types but than I tried following lines of code:
<br />
string s="";<br />
Console.WriteLine (s.GetType().IsPrimitive.ToString());<br />
It prints false!!
Do I make something false, or does anybody have an explanation for that??
mfg
|
|
|
|
|
System.String is a class.
AFAIK the pseudo-primitive type string is only a shortcut for System.String .
|
|
|
|
|
Yes, I know. int is also just a shortcut for System.Int32.
What I'm wondering about is, that Mr. Richter writes in his book, that string is a Primitive type and the command returns false at this method call. It also does with decimal datatype (decimal is no class), but it does not with int.
|
|
|
|