|
Hi,
i wasn't sure what is the default value value of a boolean. Unfortunately it is the wrong one for your needs
In this case you won't get around using a for loop to initialize the array:
bool[] array = new bool[5];
for (int index = 0; index < array.Length; index++)
array[index] = true;
www.troschuetz.de
|
|
|
|
|
Hallo,
I want to build a server and a client application.
The server should be some kind of intelligent. He is able to process information from one format to another.
The client should be thumb. On the client machine is an Excel application which could be started by the client.
The situation is that the client starts the Excel application and remembers a pointer to it. This pointer should be send to the server. The server should use the pointer to execute commands directly on the Excel application on the client machine. For example to open an Excel workbook that lies on the client machine and to read information from a worksheet of this workbook.
How can I realize the communication between the server and the client? Can I use Remoting or should I use some kind of socket communication? Is there a tutorial which I can use as a reference?
Thanks allot
Andre Pietsch
PS: sorry if there are mistakes in my english
|
|
|
|
|
I have the following code to rotate an image:
Image img=new Bitmap(400,400);
//assigned to pictureBox 4
pictureBox4.Image=img;
Graphics g=Graphics.FromImage(pictureBox4.Image);
//Create a new matrix
Matrix mm=new Matrix();
mm=new Matrix(1,0,0,-1,0,0);
mm.Translate(25,104,MatrixOrder.Append);
g.Transform=mm;
Matrix mm1=new Matrix();
mm1.RotateAt(
trackBar1.Value,
new Point(67,2),
MatrixOrder.Append);
GraphicsPath gp=new GraphicsPath();
Image imgpic=(Image)Rotor_pictureBox.Image;
gp.AddPolygon(new Point[]{new Point(0,Rotor_pictureBox.Height),new Point(Rotor_pictureBox.Width,Rotor_pictureBox.Height),new Point(0,0)});
gp.Transform(mm1);
//get the resulting path points
PointF[] pts=gp.PathPoints;
//draw on the picturebox content of imgpic using the local transformation
//using the resulting parralleogram described by pts
g.DrawImage(imgpic,pts);
pictureBox4.Refresh();
This code works great. However, I can't get the image to BrintToFront. I need it to rest on top of another picturebox. If there is another picture box within the rotating image's area, it covers it up. I tried to put an image WITHIN the picturebox that the rotating image is being drawn on, but it doesn't show up. Any help would be much appreciated. Thanks.
D
-- modified at 7:41 Wednesday 5th October, 2005
|
|
|
|
|
I have designed a form with border style = none.
now I put the panel on top what I want is to move the form on mousedown event of panel. if any one can help me would be appreciated. I found one code for VB.Net . if any one can convert this would be great
Private Declare Function ReleaseCapture Lib "user32" () As Integer
'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1016"'
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Object) As Integer
Private Const HTCAPTION As Short = 2
Private Const WM_NCLBUTTONDOWN As Short = &HA1s
Private Const WM_SYSCOMMAND As Short = &H112s
' the event part is
Dim Button As Short = e.Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
Dim X As Single = VB6.PixelsToTwipsX(e.X)
Dim Y As Single = VB6.PixelsToTwipsY(e.Y)
ReleaseCapture()
SendMessage(Handle.ToInt32, WM_NCLBUTTONDOWN, HTCAPTION, 0)
thanks for the support
|
|
|
|
|
Point MouseCurrrnetPos,MouseNewPos,formPos,formNewPos;
bool mouseDown=false;
private void MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
//Calculate offset
if(e.Button==MouseButtons.Left)
{
mouseDown = true;
MouseCurrrnetPos = Control.MousePosition;
formPos = this.Location;
}
}
private void MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
mouseDown=false;
}
private void MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(mouseDown==true)
{
// get the position of the mouse in the screen
MouseNewPos=Control.MousePosition;
formNewPos.X=MouseNewPos.X-MouseCurrrnetPos.X+formPos.X;
formNewPos.Y=MouseNewPos.Y-MouseCurrrnetPos.Y+formPos.Y;
Location=formNewPos;
formPos=formNewPos;
MouseCurrrnetPos=MouseNewPos;
}
}
Simply call the three event handlers within the "Event" properties for the control you plan to use.
D
|
|
|
|
|
hi
i am trying too connect excel sheet with my program but its giving me an error "unrecognised formt of database" this is my connectionstring
string s="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Book1.xls;Extended Properties="+"Excel 8.0;HDR=Yes;IMEX=1"+"";
con= new OleDbConnection(s);
con.open();//--------------------->its giving exception on this line
helpers hand
|
|
|
|
|
First I redefine the IHTMLElementRender interface:
[Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
ComVisible(true),
ComImport]
interface IHTMLElementRender
{
void DrawToDC([In] IntPtr hDC);
void SetDocumentPrinter([In, MarshalAs(UnmanagedType.BStr)] string bstrPrinterName, [In] IntPtr hDC);
};
and the following code is baseing on C#
I am not sure what exactly I am doing wrong:
Process m_Proc=Process.Start("IExplore.exe");
//this.WindowState=FormWindowState.Minimized;
Thread.Sleep(500);
InternetExplorer m_IE = null;
while(m_IE==null)
{
foreach(InternetExplorer Browser in sws)
{
if(Browser.HWND == (int)m_Proc.MainWindowHandle)
{
m_IE = Browser;
break;
}
}
Application.DoEvents();
}
if(m_IE==null)
{
MessageBox.Show("no InternetExplorer open,please try agin");
return;
}
object v1="",v2="",v3="",v4="";
m_IE.Navigate("http://mail.163.com",ref v1,ref v2,ref v3,ref v4);
IHTMLDocument2 doc=(IHTMLDocument2)m_IE.Document;
if(doc==null)
{
MessageBox.Show("why document is null?");
return;
}
IHTMLElement em=(IHTMLElement)doc.body;
if(em==null)
{
MessageBox.Show("IHTMLElement is null");
return;
}
AxWebBrowserSystem.InvalidCastException
But when I Use AxWebBrowser control
the Cast(IHTMLElementRender ren=(IHTMLElementRender)em;) is ok
Thanks for any help!
|
|
|
|
|
HI Friends,
Look at this.
I have a array like this.
A B C
P Q R
1 2 3
Now I want something like the following.
AP1, AP1, AP3, AQ1, AQ2, AQ3, AR1, AR2, AR3,
BP1, BP2, BP3, BQ1, BQ2, BQ3, BR1, BR2, BR3,
CP1, CP2, CP3, CQ1, CQ2, CQ3, CR1, CR2, CR3,
The total number of combination will be 3 * 3 * 3;
THis is the problem.
Do u have any recursive logic of this.
Mind well,this array can be of any size.
Thank u all in advance.
|
|
|
|
|
How can I get an event of one process that is terminating in other process.Any idea ?
|
|
|
|
|
Get a Process object for the wanted process e.g. by calling Process.GetProcessesByName . Then set its EnableRaisingEvents property to true and register to its Exited event.
www.troschuetz.de
|
|
|
|
|
Hi,
I have been trying to use Asynchronous Callback to access
XML Web Services from my client application (Windows Form).
The client will call the method which will return a DataSet
and display the results on the DataGrid.
The problem is, the DataGrid doesn't seem to be updated
everytime the result is returned. Anyone knows why?
I have also checked using Debugger and the web method did
return the correct result.
Thanks.
|
|
|
|
|
|
|
Hi!
I am having a typical problem ,I am using management classes to get the path for shared folders and files of the system.The code is working fine for console and winforms,but it is not working for web applications.I have tried giving admin rights to aspnet account,but the problem remains there.Please help
ManagementObjectSearcher searcher1=null;
searcher1=new ManagementObjectSearcher("SELECT * FROM Win32_Share");
try
{
foreach(ManagementObject share in searcher1.Get())
{
s=share["Path"].ToString();//for asp.net pages giving null obj ref exception
}
|
|
|
|
|
I dont know how to play dat files in a C# form .If anybody has any idea please let me know .Thank you.
|
|
|
|
|
|
Hi,
I am beginning visual c# programming with xaml.
I was told, creating xaml file can be done using xamlpad. I am not clear with how to integrate this file with visual c# project and create an corresponding .xaml.cs file and add it under .xaml file.
Can somebody guide me how to create a .xaml project with visual c#, like the sample projects available in winfx sdk samples.
Thanks,
|
|
|
|
|
Are you using Visual C# 2005 Express or Visual Studio? Or are you compiling everything by hand?
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
When a value of CELL such as Grid was changed, a setting color wants to change temporarily, but is who or good advice not?
I'm Studying
|
|
|
|
|
Hi,
I have an application which will connect to server A. However if server A fails...it should try to connect to server B. I have no idea how to go about implementing this. Any suggestions?
|
|
|
|
|
What type of connection is this? Database? File share? Custom protocol?
Start by putting all of your communication-related code into a separate class (or at least identifying which classes you use fits this description): should specific exceptions get thrown, you simply reinstantiate or reconfigure the class with different parameters (telling it to use server B). In the case of a database connection, as an example, you would change the connection string.
This outlines the structure of a solution, but without more information I can't really help you.
|
|
|
|
|
Hi,
Tks for the reply. The connection is a database one. I had guess changing the connection string. However does connection lost or no connection exceptions come with common error strings.
I guessing using this.
try
{
str1 = db1;
conn.ConnectionString = str1'
conn.open();
}
catch(Exception msg)
{
if(msg.Message.ToString()=="No Connection")
{
try
{str1 = db2;
conn.ConnectionString = str1;
conn.Open();
}
catch(Exception msg1)
{
MessageBox.Show("Total Connection Lost");
}
}
}
Something like these?
|
|
|
|
|
Try: catch (SqlException ex). You can get far more from exceptions than that:
Put a breakpoint on your MessageBox.Show, then quick-view the exception when the code gets there. You'll get a lot of info from there, including the actual sub-type of the exception that got thrown.
|
|
|
|
|
tks for the reply...
ok i tried that...I'm guessing i could use the number property to specify the error that i need to process..Also, there's one thing that puzzle me. There is a ConnectionState.Broken...when will this state occur? i tried have a connection open..then pluck off the cable..so i thought this is suppose to be connection broken. However the state of the connection is still open. Is there anything that i can refer to as to detect a break in connection from an open connect?
|
|
|
|
|
hi..
i hav developed an application to send fax automatically..i want to put this application in to the system tray how can i do that..
thanks...
|
|
|
|
|