|
There are lot of propeties present in the DataGridView Class for column header in MSDN.
Please refer MSDN. some of them are,
- ColumnHeadersBorderStyle
- ColumnHeadersDefaultCellStyle
- ColumnHeadersHeight
- ColumnHeadersHeightSizeMode
- ColumnHeadersVisible.
Praveen Raghuvanshi
Software Engineer,
Wins Infotek Pvt. LTd.
India.
|
|
|
|
|
Thanks man...
Devesh Mishra
|
|
|
|
|
Hai everybody,
Can u give me a hint how to make two windows service to communicate.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Hi Jaya,
One way is to use Remoting.
You can also use MSMQ. There might be more ways of doing this. The best way needs to be figured out based on your application requirements.
i Think, i Wait, i Fast rAm
|
|
|
|
|
As ganti pointed out, there are more ways to let the service communicate with eachother. Another option is using a memory pipe to communicate. But I personally think remoting might be a better solution.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
What do you mean my remoting can you give me a reference site for it.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
|
Yes.
you have to define URL with IP Address in Remoting.
Pavan Pareta
|
|
|
|
|
We use MSMQ. That way the second windows service can just wait till the first Windows service puts something on the queue before it tries to do anything.
Ben
|
|
|
|
|
Hello together,
I have to get the full username. My solution only gets it for local users but I need it also when the user is logged in by a domain account. Has anybody an idea how do get this?
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
namespace UserInfo<br />
{<br />
public class Program<br />
{<br />
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]<br />
public struct USER_INFO<br />
{<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
public String username;<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
public String password;<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
public String comment;<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
public String fullname;<br />
}<br />
<br />
[DllImport("Netapi32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]<br />
private extern static Int32 NetUserGetInfo(<br />
[MarshalAs(UnmanagedType.LPWStr)] String ServerName,<br />
[MarshalAs(UnmanagedType.LPWStr)] String UserName,<br />
Int32 level,<br />
out IntPtr BufPtr);<br />
<br />
[DllImport("Netapi32.dll", SetLastError = true)]<br />
static extern Int32 NetApiBufferFree(IntPtr Buffer);<br />
<br />
public static String GetFullname()<br />
{<br />
String retVal = String.Empty;<br />
<br />
try<br />
{<br />
USER_INFO objUserInfo = new USER_INFO();<br />
IntPtr bufPtr;
Int32 lngReturn = NetUserGetInfo(Environment.MachineName, Environment.UserName, 10, out bufPtr);<br />
if (lngReturn == 0)<br />
{<br />
objUserInfo = (USER_INFO)Marshal.PtrToStructure(bufPtr, typeof(USER_INFO));<br />
retVal = objUserInfo.fullname;<br />
}<br />
NetApiBufferFree(bufPtr);<br />
bufPtr = IntPtr.Zero;<br />
}<br />
catch (Exception ex)<br />
{<br />
Console.WriteLine("GetFullname: " + ex.Message);<br />
}<br />
<br />
return retVal;<br />
}<br />
<br />
public static void Main(String[] args)<br />
{<br />
Console.WriteLine("Login name: " + Environment.UserName);<br />
Console.WriteLine("Full username: " + GetFullname());<br />
Console.ReadLine();<br />
}<br />
}<br />
}
Greets
Patrick
|
|
|
|
|
Try this:
Environment.UserDomainName + "\\" + Environment.UserName
It should return "domain\user"
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
How can I create win application that may launch through local network from another PC, where it is installed?
When I start application through network appears below error:
System.Security.SecurityException was unhandled
Message="That assembly does not allow partially trusted callers."
Source="SqlTool"
StackTrace:
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at SqlTool.frmSql.Main()
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
How to solve this problem?
Thanks for any answer.
|
|
|
|
|
Run a search on all previous questions, I remember answering this question last week I think.
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Can you help me to find it, I don't succeed locate this article.
|
|
|
|
|
It wasn't an article and I can't find it either, it says the server crashed.
Here is some code that should help you though:
Client:
using System;
using System.Net.Sockets;
using System.IO;
using System.ComponentModel;
namespace NetClient
{
class Program
{
static void Main(string[] args)
{
NetworkStream networkStream;
StreamWriter streamWriter;
TcpClient myclient;
try
{
myclient = new TcpClient(args[1], 1234);
}
catch
{
Console.WriteLine("Failed to connect to server at {0}:999", "localhost");
return;
}
networkStream = myclient.GetStream();
streamWriter = new StreamWriter(networkStream);
try
{
string s;
streamWriter.WriteLine(args[0]);
Console.WriteLine("Sending Message");
streamWriter.Flush();
}
catch (Exception ee)
{
Console.WriteLine("Exception reading from Server:" + ee.ToString());
}
streamWriter.Close();
networkStream.Close();
Console.ReadLine();
}
}
}
Run the client from the console with the name of the program you want to start as an argument. e.g. program calc //will start calculator.
Server:
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
namespace NetServer
{
class Program
{
static void Main(string[] args)
{
TcpListener tcpListener = new TcpListener(1234);
tcpListener.Start();
Console.WriteLine("Server Started") ;
Socket socketForClient;
try
{
while(true)
{
try
{
socketForClient = tcpListener.AcceptSocket();
Console.WriteLine("Client connected");
NetworkStream networkStream = new NetworkStream(socketForClient);
StreamReader streamReader = new StreamReader(networkStream);
string line = streamReader.ReadLine();
System.Diagnostics.Process.Start(line);
socketForClient.Close();
}
catch (Exception)
{ }
}
}
catch(Exception e)
{
Console.WriteLine(e.ToString()) ;
}
Console.ReadLine();
}
}
}
The server app must be running before you run the client. You may have to turn off your firewall. Hope this helps. Let me know if you get stuck.
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
|
Where can I download an ivaluation version from?
|
|
|
|
|
boundschecker is for C++ programs, C# programs are garbage collected.
From memory, when I used it, I had to put my name down and take a call from a rep before they would send it to me.
But I did type 'boundschecker download' into google and get a ton of hits.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
To bind a value from DataGridView to textbox
when i am assigning it to a textbox like
txtcuscode.Text= dataGridView1.SelectedRows[0].Cells[0].Value;
shows an error message like this following..
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
the error is at this line...
txtcuscode.Text= Convert.ToString(dataGridView1.SelectedRows[0].Cells[0].Value);
the error handler points to the property text of the textbox...
help me overcome this..
plz help me recover this and thanks a lot for the code.....
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
|
|
|
|
|
sajan ss wrote: txtcuscode.Text= dataGridView1.SelectedRows[0].Cells[0].Value;
well either the SelectedRows collection count is 0 or less probable Cells collection of first selected row count is 0.. so you should check like this:
if(dataGridView1.SelectedRows.Count>0)
txtcuscode.Text= dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
as for the binding itself..
txtcuscode.DataBindings.Add(new System.Windows.Forms.Binding("Text", source, "field_name", true));
where source is a BindingSource or a DataSet object..
life is study!!!
|
|
|
|
|
I instantiation an OCX Control, as follows:
AxZHFILEOCXLib.AxZhFileOcx fileOCXSend = new AxZHFILEOCXLib.AxZhFileOcx();
fileOCXSend.Tag = pfti;
fileOCXSend.bSender = true;
but "fileOCXSend.bSender = true" got an Exception. as follows:
“System.Windows.Forms.AxHost+InvalidActiveXStateException” Exception.
what is cause abuout it?
Thanks.
|
|
|
|
|
|
all the following is with respect to C#.Net
In remoting for better speed we opt for TCP channel.
why is TCP is faster than HTTP.
|
|
|
|
|
If you use Socket you get more speed.
Manoj
Never Gives up
|
|
|
|
|
socket or remoting whichever be the case,but why is that TCP faster than HTTP
|
|
|
|