|
The way forms (which are just windows) are handled in Windows means that each application can only really draw on its own windows (I say only really, because I'm sure there are ways you could hack into the windows API and draw over some other app's windows)
The problem is that the other app will refresh, and re-draw whatever it wants in its own window (as you'd expect)
How about opening a frontmost form of your own, and setting the whole thing to be transparent (you can set a transparency colour, iirc, which will make any part of your form painted in that colour become transparent, and show the window behind)
You can then draw all over that form to your hearts desire, which should have the effect you're after
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
hi,
I want to pass the database name to a crystal report
i don't want the database to be static
of course the report opened in crystalReoprtViewer from the C#
thanks
|
|
|
|
|
You might consider a better approach that is more robust: use an ADO.NET DataSet . If you build a typed DataSet using xsd.exe or Visual Studio .NET (add a new DataSet item to your project; or drag a table, view, or stored procedure that returns a result set from the Server Explorer). When designing your report, bind to that typed DataSet and you can design your report just as if you built it against a connected database.
Before displaying your report, you get the DataSet however you see fit - from one SQL database or another, or from an Oracle database or even read from an XML file representation of a DataSet - then pass the instance to the SetDataSource method of the ReportDocument .
This way you can use any data source you want, so long as the data ends up in a DataSet that uses the same schema as the typed DataSet you've designed.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Server Error in '/MSPOS' Application.
--------------------------------------------------------------------------------
DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name REPORTTO.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name REPORTTO.
Source Error:
Can someone help me with this one they say that databind.eval is sometimes to fast.
private DataSet BindUserNames()
{
// Populate the ddlDataSet
OdbcConnection myConnection = new OdbcConnection("DSN=POS;UID=system;PWD=system");
myConnection.Open();
const string strSQLDDL = @"SELECT USERID,REPORTTOID,USERNAME,GetUserName(REPORTTOID) AS REPORTTO FROM TBUSERS";
OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
ddlDataSet3.Clear();
myDataAdapter.Fill(ddlDataSet3, "ddlReportTos");
myDataAdapter.Dispose();
myDataAdapter = null;
// In next 2 lines, Dispose removes connection string info, Close is better.
// Use one or the other, but not both...
// myConnection.Dispose();
myConnection.Close();
return ddlDataSet3;
}
//************************************************************
<asp:templatecolumn headertext="Reports To">
<itemtemplate>
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "REPORTTO")) %>
<footertemplate>
<asp:dropdownlist id="insertReportTos" datasource="<%# BindUserNames() %>" datatextfield="REPORTTO" datavaluefield="REPORTTOID" runat="server">
<edititemtemplate>
<asp:dropdownlist runat="server" id="ddlReportTos" datasource="<%# BindUserNames() %>" datatextfield="REPORTTO" datavaluefield="REPORTTOID" selectedindex="<%# GetSelectedIndexReportsTo(DataBinder.Eval(Container.DataItem, "REPORTTO").ToString())%>">
|
|
|
|
|
This question should be posted in the ASP.NET forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
While learining .NET, I've come across some concepts that I'm not sure if I should avoid them. What I mean is that I've been told that I should avoid using Win32 API calls and stuff like that in a dotNet application (just write pure .NET and not involve Win32 directly in my application). But I'm not sure about if it's possible and even wise. Is it ?
Any good article somewhere how to avoid Win32 dependancy (to ensure Mono/Linux compatibility) ?
There are some objects that I'm not familiar wether they're .NET or Win32:
1. System.Windows.Forms.Message - as I've understood so far, Win32 uses messages and dotnet not. So it's a wrapper to Win32 message ? Should I use messages when developing user interface in C# ?
2. Hooks - if I'm already dealing with messages there's no need to avoid them, right ?
3. Handles - System.IntPtr - I have a feeling they're also more Win32 than dotNet ... are they ???
I hope the questions make sense at all ...
Regards, Desmond5
|
|
|
|
|
The best place to get answers for these are on the forums for Mono, .Gnu, and Portable.NET.
Most of the base class library encapsulates native Win32 functionality, BTW, not just Windows Messages. Most of the Windows Forms controls encapsulates the Windows Common Controls while much of the System.Drawing classes encapsulate GDI+. The list goes on.
The fact of the matter is that what's on the surface is what counts. So long as the base class library in the non-.NET implementation of the Common Language Infrastructure (CLI) implements the same Types and Type members, you'll be fine (and also that the assemblies have the same strong name).
While System.Windows.Forms.Message may not be good to use, you don't have to so long as you don't try to implement Common Control custom functionality (like custom drawing).
An IntPtr , BTW, is just a native handle, which is a 32-bit integer on 32-bit platforms and 64 bits on 64-bit platforms.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
hey to all,
i am trying to parse a source file to determine the class name from its signature using regex
i can get it as long as the file doesnt include anything after the '{' in the signature,
can anyone offer help pls?
[code]
Regex regex = new Regex(@"(?<=\bclass\s+\b)\w+(?=\s*\{)");
this works fine for examples like:
// this is class file
public class Tester
{
}
internal class InternalTester{
}
// output misses commented 'class' keyword, this is good
[/code]
but if i have say a java example or if i extend a class it fails
like:
[code]
public class Form1 : System.Windows.Forms.Form
{
}
// or java
public class Listener extends Thread
{
[/code]
also i would like to be able to change the keyword it is trying to find with something this (which is wrong)
[code]
static string KEYWORD = "class";
Regex regex = new Regex(@"(?<=\b" + KEYWORD + "\s+\b)\w+(?=\s*\{)");
[/code]
any suggestions pls ?
kind regards
maurice
|
|
|
|
|
Doesn't answer your question but it may help
Regulator[^]
|
|
|
|
|
I am trying to escape quotations in the following scenario:
I have a string variable, and text that I need to pass to a system command. But I need to include quotes IN one of the elements of the system command.
string gar = "Variable";
string subject = gar + "Here is some more text";
System.Diagnostics.Process.Start("command.bat" + gar);
The kicker for me is that the subject MUST include quotes (") around the entire variable to the command line like this:
c:\command.bat "Variable Here is some more text"
Any ideas ?
--
sween
|
|
|
|
|
How about this:
string subject = "\"" + gar + "Here is some more text\"";
www.troschuetz.de
|
|
|
|
|
|
I need to programatically bring up the Windows logon dialog. I don't want to find any usernames or passwords, just force the user to re-enter his credentials - this is to prevent unauthorised users from changing settings in the application if the authorised user has walked away from his desk for a few minutes.
There must be a simple c# method that does this!
|
|
|
|
|
Actually, I think you want to enable the screen saver and make sure that it is asking for a password to unlock. You can't force the Windows Login to show up again just to authenticate.
If your application times out and locks itself, you have to put up your own form to capture credentials, then you can pass those to something like Active Directory to authenticate.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks, OK, but is there a way to force the screensaver to come up immediately? I just want to ensure that, when someone presses a 'save' button that changes a database, they immediately get a request for credentials.
I don't want to create a new form to capture credentials since there is no way to check the Windows NT password.
|
|
|
|
|
using System.Diagnostics
Process.Start("scrnsave.scr");
|
|
|
|
|
using System;
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public static extern void LockWorkStation();
LockWorkStation();
|
|
|
|
|
Hi,
im fiddling around a bit with a repeater for win forms
and just wanted to see if there is a need for such component or if its just plain stupid :P
the idea is pretty much to make it somewhat like an editeble report.
and let users edit data in a gui that actually look like something rather than just tabular data as in normal grids
and also , any feature suggestions?
http://www.compona.com/winrepeater.gif[^]
//Roger
|
|
|
|
|
Hello,
I am self learning C# (visual C#) and I am doing some basic project. I just need some help in how I should code this program. I kind of thought through it, but i am trully not doing good. Just to keep moving, I thought I would ask for help in here. Here it is:
Write a program that will implement a Complex class and a simple Main program that will demonstrates the use this class.
You must create two classes. Complex stores its real part and imaginary part. Add a few constructors to allow statements like these ones:
Complex plxZ;
Complex plxX = new Complex (4.5, 6.0);
Complex plxY = new Complex (plxX);
Add five operators (+ - * / ^) to allow statements like these ones:
plxZ = plxX + plxY;
plxZ = plxX ^ 7;
Override the ToString() method to allow statements like these ones:
tbOutSum.Text = plxZ.ToString ();
Create a simple Main class to use Complex. This should allow the user to enter complex numbers and an integer, and then demonstrate the five operations on these numbers.
I will trully appreciate any help on this matter,
Thank you in advance,
A Newbie In Tha Block
|
|
|
|
|
What are your concrete problems? Where are you stuck?
Just providing your task gives the impression that you want us to write the whole code for you, but i don't think this is the case here.?
www.troschuetz.de
|
|
|
|
|
Hello,
how can i add c# application on windows start up.
i dont want to add in start up folder.Is there any othere
way? like yahoo messanger which is not appeared in start up
folder..
|
|
|
|
|
Put a value for it in one of the following folders.
For All users:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
For the current users:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
|
|
|
|
|
How can i add this from c# application?any example
|
|
|
|
|
using Microsoft.Win32;
.....
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey run = hkcu.OpenSubKey("Software\\Microsoft\\Windows\\CurrentUser\\Run");
run.SetValue("MySoftware", "C:\\Path\\To\\Software.exe");
something like that should do the trick.
|
|
|
|
|
using Microsoft.Win32;
string strAssemblyPath;
strAssemblyPath = System.IO.Path.GetDirectoryName(base.Context.Parameters[ASSEMBLYPATH_STATENAME]);
Process.Start(strAssemblyPath+"\\Application.exe");
RegistryKey MainKey;
MainKey=Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths");
RegistryKey ApplicationKey=MainKey.OpenSubKey("Application",true);
ApplicationKey.SetValue("Application.exe",strAssemblyPath+"\\Application.exe");
Check the Above code written in c#. This Code i have written for writting my application path into registry.
And u can add the application to the Start up in another way also.
Check while creating setup u can create a chort cut to the start menu startup folder. that will also run the application.
Arun Kumar Sabat
|
|
|
|