|
<pre lang="c#">OpenFileDialog dlg = new OpenFileDialog();
#endregion
#region DIALOG BOX SETTINGS
string previousOpenFilePath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
dlg.RestoreDirectory = true;
dlg.DefaultExt = ".xml";
dlg.Filter = "XML Document (*.xml)|*.xml|Excel File (*.xls)|*.xls|Excel File (*.xlsx)|*.xlsx|VPI File (*.vpi)|*.vpi|All Files (*.*)|*.*";
#endregion
dlg.CheckPathExists = true;
dlg.CheckFileExists = true;
if (dlg.ShowDialog() == DialogResult.OK)
Here the exception comes at the showdialog call. The stacktrace goes in eventviewer.
|
|
|
|
|
Looks good
..and how does the filename/initial path look like?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hello!
I created a process containing a NamedPipeServerStream and second process NamedPipeClientStream.
I managed to establish communication between both processes on the same server. Is also worked on two different computers over the network, after I created the same USER and Password on both computers.
But it only worked, if after i assigend the group "Administartors" to the users. Is it possible to establish connection between without beeing Administrator?
My first Try:
NamedPipeServerStream m_PipeServerStream = new NamedPipeServerStream(
Properties.Settings.Default.PIPE_NAME
, PipeDirection.InOut
, SERVER_THREADS
, PipeTransmissionMode.Byte
, PipeOptions.Asynchronous
, BUFFER_SIZE_kB
, BUFFER_SIZE_kB);
if (Properties.Settings.Default.SERVER_USER.Count > 0)
{
foreach (string item in Properties.Settings.Default.SERVER_USER)
{
m_PipeServerStream.GetAccessControl().AddAccessRule(new PipeAccessRule(
item
, PipeAccessRights.ReadWrite
, System.Security.AccessControl.AccessControlType.Allow));
}
}
|
|
|
|
|
True_Posi wrote: Is it possible to establish connection between without beeing Administrator?
It is according to the docs[^]; take a look at the end of the page, the section called "community content".
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
According to docs you linked, i added the following code to my Server:
PipeAuditRule auditRule = new PipeAuditRule("Everyone", PipeAccessRights.FullControl, AuditFlags.Failure);
PipeAccessRule accessRule = new PipeAccessRule("Everyone", PipeAccessRights.FullControl, AccessControlType.Allow);
m_PipeServerStream.GetAccessControl().AddAuditRule(auditRule);
m_PipeServerStream.GetAccessControl().AddAccessRule(accessRule);
But the user must still be an "Administrator".
The Server application runs on a Windows Server 2008 R2 and the client on Windows 7.
|
|
|
|
|
Did you get an exception? I'm wondering whether it's that particular code that requires admin-permission; does the bare-bones example ask for the same permissions?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I think it simply does not connect (as far as i found out).
I also tried it with an AccessRole of a usergroup, i created only for users of my server. it does not work.
Code from the Server thread (As it works as with absolutely equal user accounts):
private void NMP_ServerThread()
{
int threadId = Thread.CurrentThread.ManagedThreadId;
try
{
NamedPipeServerStream m_PipeServerStream = new NamedPipeServerStream(
Properties.Settings.Default.PIPE_NAME
, PipeDirection.InOut
, SERVER_THREADS
, PipeTransmissionMode.Byte
, PipeOptions.Asynchronous
, BUFFER_SIZE_kB
, BUFFER_SIZE_kB);
Console.WriteLine(string.Format("SERVER: Thread {0} :Waiting for child process connection...", threadId));
pipeServerInstancePool.Add(threadId, m_PipeServerStream);
this.State = ServerState.Started;
pipeServerInstancePool[threadId].WaitForConnection();
if (pipeServerInstancePool[threadId].IsConnected)
{
NMPEventArgs args = new NMPEventArgs();
args.State = ClientState.Conneceted;
RaiseOnClientSateChanged(this, args);
while (State == ServerState.Started && pipeServerInstancePool[threadId].IsConnected)
{
StartAsyncReceive(threadId);
}
}
}
catch (ObjectDisposedException)
{
this.State = ServerState.Closed;
}
catch (IOException)
{
this.State = ServerState.Closed;
}
RaiseOnClientThreadFinished(this, new ClientThreadFinishedArgs(threadId));
}
Client Thread:
private void NMP_ClientThread()
{
pipeClient = new NamedPipeClientStream(
Properties.Settings.Default.PIPE_SERVER
, Properties.Settings.Default.PIPE_NAME
,PipeDirection.InOut
,PipeOptions.Asynchronous
,TokenImpersonationLevel.Impersonation);
try
{
try
{
pipeClient.Connect();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
if (pipeClient.IsConnected)
{
RaiseOnStateChanged(this, new StateChangedEventArgs(ClientState.CONNECTED));
}
while (stopClient == false && pipeClient.IsConnected == true)
{
StartAsyncReceive();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
RaiseOnConnectionLost(this, new EventArgs());
}
|
|
|
|
|
Hi all!
I've got a problem with a where clause in a subcollection, the situation is like this.
I've got a collection of schools, in that collection there's an other collection of students. I want to perform a where clause in de student collection.
So, its like this:
List<schools>
- Id: Guid
- Name: string
- Address: string
- Director: string
- List<students> (- Id: Guid, - Age: int, - Address: string, - Study: string)
I want to do something like this (which doesn't work... ), so I only pass all the schools with all the students who study IT.
CheckStudents(School.Where(s => s.Students.Where(s => s.Study == "IT")))
The method signature CheckStudents looks like this: CheckStudents(List<schools>)
Can anyone help me out on this?
Thanks in advance!
|
|
|
|
|
Are your collections actual .Net classes or are they themselves just lists ? It is not clear the way you have structured your question.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Off the top of my head, you should be able to use the Any clause in place of the inner Where , and you need to apply .ToList() at the end to convert it from a query into a concrete collectino.
|
|
|
|
|
Query methods are only for selecting or creating objects, not modifying them. So you can't pass school objects with the student list modified to only contain students studying IT, unless you create a new School.
I think you want CheckStudents to take the list of schools and the subject:
void CheckStudents(IEnumerable<School> schools, string subject){
foreach(School school in schools){
var students = school.Students.Where(s => s.Study == "IT");
}
}
Or if you want to filter the schools you can do
CheckStudents(School.Where(s => s.Students.Any(s => s.Study == "IT")))
... but you still need to have the students within a school filtered in a separate query.
|
|
|
|
|
hello all,
how to convert HTML file to Excel in C# without using any thirt party tool.
Thanks
|
|
|
|
|
Rename it to .xls, and open it in Excel. Presto! Alternatively, you could use ADO.NET (you can look up the connectionstring here[^]).
Those techniques are limited, in the sense that they work with raw data, and not with the Excel DOM; for that you do need a third-party library, or contact Microsoft and write your own.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy,
I tried with renaming of html file to xls .It did work.But,I got to know that we can convert the Html file to Xml and later that xml file con be converted to .xls
Thanks
|
|
|
|
|
Excel supports multiple formats, and the first thing you need to find out is the lowest version that you need to support. The older versions, like the Excel 95 binary format will require an third-party tool.
For the newer version, I'd recommend the Office OpenXml format; that too, is a complexer format, and you don't want to waste time on reimplementing it yourself. If you only need it as a report, I'd go for Xml, and simply rename it to Xls; that way you wouldn't have access to the advanced functions, just as with ADO.NET.
You'll have to invest some time in looking at the advantages and disadvantages of each of these options
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
how can i create an interface for crystal report at user end.user could be able to move report objects like textobjects from one place to another.pls help me to solve this
|
|
|
|
|
You have already asked this in QA, editing crystal report at user end[^] and received an answer.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Is there not such a control you can host in your app? I know Active Reports did ten years ago, so I expect Crystal does by now.
|
|
|
|
|
Hello
I have question:
- how I can change location my task bar from C# code ?
Default location is in bottom, I need in C# - change position my task bar: left, right, top, bottom.
How I can start ?
|
|
|
|
|
mt1024 wrote: How I can start
I'd start with a Google [^]search, then I'd read some of the responses and see if they give me any ideas for further research.
After that I would refine my searches, read the articles and create a project based on the samples and replies. If I had a specific problem I would either ask on the forum where the article/reply was posted or ask here.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The 'normal' ways of doing this no longer work since Vista - let's face it, it's not great for a user if a program moves their taskbar!
The only way I know of to do this now is to simulate clicking, dragging and releasing the mouse at the right coordinates.
|
|
|
|
|
For a C# 2008 desktop/console application I want to share a linq to sql (*.dbml file) between 2 different project files in the same solution.
I know that I should probably put the linq to sql (*.dbml file) in its own project file with a class libary?
Since I do not know how to accomplish this goal, I am wondering if you can point me to a reference on how to accomplish this goal?
|
|
|
|
|
|
Your link is good! However, I would like to use linq to sql (*.dbml) files since that is the way I have the code setup currently.
I have told my boss that (linq to sql) or linq to the entity framework is the better way to go since that is the newest technology. (My boss has some java experince.)
Thus can I setup the class library that connects to the database by using linq to sql and/or linq to some other technology? If so, can you tell me and/or point me to a reference that will accomplish this goal?
|
|
|
|
|
If your talking about non .NET technologies, no. But if you want to create a suit of applications based on .NET, then the n-tier dsign is the way to go. Build a data access library (DAL). Create a business layer (BAL) that references the data access library. Then create seperate applications that reference the business library.
You may be able to take your existing code and refactory it out into the different layers and then start building the new applications and share all that common DAL and BAL code. If your forms/pages are making calls directly to the database in your corrent solution: it may be harder.
"You get that on the big jobs."
|
|
|
|