|
I'm sorry.
But anybody know how to fix this problem ?
Please help me.
Thanks.We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
Writing shell extensions in anything but .NET 4.0 is not supported and highly inadvisable. You've been shown the article describing why.
|
|
|
|
|
I'm currently writing a wrapper for Fossil (www.fossil-scm.org[^]).
I'm trying to pass two double quoted arguments to cmd.exe, but there seems to be a problem with my command and I can't find what's wrong with it.
here's a snippet of my code:
var proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/c " + Command;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.CreateNoWindow = true;
Debug.WriteLine(proc.StartInfo.Arguments);
proc.Start();
Output = proc.StandardOutput.ReadToEnd();
Here are my cases:
======
1
proc.StartInfo.Arguments: "/c \"C:\\Documents and Settings\\Simon\\Bureau\\Fossil\\fossil.exe\" new \"C:\\Documents and Settings\\Simon\\Bureau\\test1\""
Debug.WriteLine: /c "C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new "C:\Documents and Settings\Simon\Bureau\test1"
Output: "" (doesn't work in my project, but using the same command directly in cmd.exe does work. I don't understand why.)
======
2
proc.StartInfo.Arguments: "/c \"C:\\Documents and Settings\\Simon\\Bureau\\Fossil\\fossil.exe\" new C:\\hello\\testing\\test1"
Debug.WriteLine: /c "C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new C:\hello\testing\test1
Output: *works as expected*
======
There seems to be a problem with my second double quoted string, but I don't understand why.
I would be really grateful if anybody could help me on this. I plan to offer this project to the community and it is pretty much my main problem currently.
Thanks a lot.
If it might help: I'm developing with VS.Net 2008 SP1 in C# with the .Net 3.5 Framework.
(I did try looking for answers in the forum, google and other sources, but couldn't find an answer for it.)
|
|
|
|
|
Hi,
I've had such experience long ago. IIRC the proper way to do it is to use double quotes around the smallest chunk of text needing it, so try ...\\"Documents and Settings"\\... , and yes that is a pain.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I followed your suggestion and..
changed:
"C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new "C:\Documents and Settings\Simon\Bureau\test1"
to:
C:\\"Documents and Settings"\\Simon\\Bureau\\Fossil\\fossil.exe new C:\\"Documents and Settings"\\Simon\\Bureau\\test1
It works flawlessly.
Thanks a lot Mr. Pattyn.
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I have a stored procedure that takes and gives me all the results based on authorFirst and authorLast
works fine when i execute it in sql server
USE [Books]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_SelectBasedonAuthor]
--Variables
@AuthorFirst varchar(50),
@AuthorLast varchar(50)
AS
SELECT Book.*, Authors.*
FROM Book INNER JOIN
(Authors INNER JOIN BookAuthors ON Authors.ID = BookAuthors.AuthorID)
ON Book.ID = BookAuthors.BookID
WHERE AuthorFirst = @AuthorFirst AND AuthorLast = @AuthorLast;
in c# I have the following but obviously it is not filtering correctly and I'm not understanding why
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
try
{
using (var db = new mombooksDataContext(Properties.Settings.Default.BooksConnectionString2))
{
String[] splitstring = null;
string treeviewtext = treeView1.SelectedNode.Text;
splitstring = treeviewtext.Split(',');
var filter = db.usp_SelectBasedonAuthor(authorFirstTextBox.Text, authorLastTextBox.Text);
bindingNavigator1.BindingSource.DataSource = filter.ToList();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
My objective is to click on the author name in the treeview and simply call the stored procedure based on that. and pass the results back so i can navigate the results using the bindingnavigator
|
|
|
|
|
I even tried doing the following but nothing seems to help...
try
{
using (var db = new mombooksDataContext(Properties.Settings.Default.BooksConnectionString2))
{
String[] splitstring = null;
string treeviewtext = treeView1.SelectedNode.Text;
splitstring = treeviewtext.Split(',');
var query = db.Books.SelectMany(o => o.BookAuthors.Where(a => a.Author.AuthorFirst == splitstring[1].ToString()));
bookBindingSource.DataSource = query.ToList();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
do i have to format the returned data somehow in order for the datasoure to understand it ?
|
|
|
|
|
Okay well I got it work sorta but i'm having an issue with the where clause. If i hardcode the value it works fine but when I take and pass it the splitstring[1].tostring() which according to the debugger contains "tony" then i get no results..
1.
String[] splitstring = null;
2.
string treeviewtext = treeView1.SelectedNode.Text.Trim();
3.
splitstring = treeviewtext.Split(',');
4.
5.
var query = from b in db.Books
6.
join ba in db.BookAuthors on b.ID equals ba.BookID
7.
join a in db.Authors on ba.AuthorID equals a.ID
8.
join bn in db.BookNumbers on ba.BookID equals bn.BookID
9.
where a.AuthorFirst ==splitstring[1].tostring()
10.
select b;
at line 9 if i make that where.a.AuthorFirst == "tony" all is fine
however if i leave it like it is then the query ends up being null. if i set splitstring[1] = "tony" in here specifically then it works. does spaces matter or am I overlooking something simple here ?
|
|
|
|
|
What's the "correct" technique for doing a modal loop in C#/Winforms? In MFC, you could use CWnd::RunModalLoop() or implement something similar, and then call EndModalLoop() to end it. Is there something similar already in place in Winforms for this? I haven't found it yet and have the nast suspicion I will need to do this from scratch.
If I do need to write this, do I want to use the raw Win32 message loop calls, or something involving Application.DoEvents()?
Here's what I'd like to happen:
Main UI thread:
send a message to a server via sockets
wait in a modal loop until the server responds or some other error condition is hit
Socket handling thread:
read socket data from server, notify main UI thread when done
|
|
|
|
|
Hi Jim,
IMO that is a strange question. I've never seen an explicit message loop in managed code.
If I understood your question correctly, this is what I might(*) do:
- main thread starts a BackgroundWorker that does the server communication and waits for results;
- meanwhile main thread shows a dialog explaining what is going on, possibly offering a progress indication, and probably offering a "cancel" button.
- when the BGW decides all is done, or when it gives up, show the final status in the existing dialog and either change the "cancel" button into an "OK" button, or, after 2 seconds, close the dialog (by which action the main thread continues).
(*) the alternative is not having a modal dialog at all (since that blocks the entire app), and use a modeless dialog instead. That of course requires a different synchronization technique, as now the main thread would never wait.
[ADDED]
FYI: this[^] may interest you.
[/ADDED]
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Monday, February 8, 2010 3:53 PM
|
|
|
|
|
Hello,
I have a datagridviewcheckboxcell in a datagrid which is displayed properly . I want a text next to the box. Which property should I use?
Thank you
Pritha
|
|
|
|
|
As far as I am aware, there is no property to put text beside the checkbox - the text goes into the column heading where it it less intrusive for the user. If you really must do this, you will probably have to create your own custom control, based on a DataGridViewCheckBoxCell, and incorporate the text yourself. I haven't tried this, so I have no idea what problems you are going to face.
Are you sure you need it, given that you can only have true / false / grey in the checkbox anyway?If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks you for your reply
I will have to derive a class from DataGridViewCheckBoxCell
Thanks
|
|
|
|
|
Hi all,
I'm sure that this has been asked quite a bit but I can not find a answer to it. I know that I have seen C# prototypes like in C/C++ .h/.cpp files but can not remember how it is done. In the several searches I have done the closest I can come to are partial classes. Is this the right direction? If so what is the proper syntax for declaring them? I like to have the decelerations in a separate file/location so I don't have to search through lines of code just to get to the functions decelerations.
Thanks for the help!!!!
-Andy
|
|
|
|
|
I could be wrong, but I don't think C# has prototypes in the same way as C or C++ - the only ones I can think of are for abstract members or interfaces. If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks!
I know that I had seen this done in a Article Source File but don't remember how it was done. If this is not a "Best Practice" what is? I am new to C#
Thanks again ...
-Andy
|
|
|
|
|
The only thing I can think of that even comes close to a "prototype" would be a delegate definition.
|
|
|
|
|
Now why did you get downvoted.. still that stupid guy from yesterday/some days back/whatever?
|
|
|
|
|
There's some wierd univoting going on around here Fived to compensate as well as for a good answer!
|
|
|
|
|
C# does not use prototypes; class definition information is culled from the object files where it is stored as metadata. Take a look through MSDN for more information on the C# language and compiler. MVP 2010 - are they mad?
|
|
|
|
|
Hello there!
I have an Xdocument created programatically, and i wan't to zip it and save it in a gzip file.
Now my problem is that i want the name of the zip file, to be independent from the name of the zipped file...
i.e the zip file will be foo.gz, and the file inside will be test.xml. Now i have read that
by using -GZipStream- you can't actually give a name to your file. i have managed to zip files, but not name them... any ideas?
Here is how i do it at the moment
private void Compress(XDocument doc, string fullUserFilePath)
{
byte[] buffer;
MemoryStream memoryStream = new MemoryStream();
XmlWriter writer = XmlWriter.Create(memoryStream);
doc.Save(writer);
writer.Close();
memoryStream.Position = 0;
buffer = new byte[memoryStream.Length];
memoryStream.Read(buffer, 0, buffer.Count());
using (FileStream outfile = new FileStream(fullUserFilePath, FileMode.Create, FileAccess.Write))
{
using (GZipStream stream = new GZipStream(outfile, CompressionMode.Compress))
{
using (BinaryWriter sw = new BinaryWriter(stream))
{
sw.Write(buffer);
}
}
}
}
|
|
|
|
|
What is the value of fullUserFilePath? Surely that will determine the name of the zip file Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
yes that is the name of the zip file, but it names the file within it like that, whereas i want to name it differently.
so at the line:
using (GZipStream stream = new GZipStream(outfile, CompressionMode.Compress))
it would be ideal if i could do something like:
using (GZipStream stream = new GZipStream(outfile,"myfileName.xml", CompressionMode.Compress))
but that's not possible ...
|
|
|
|
|
I see what you mean, what if you rename the zipped file? you can use System.IO.File.Move(...) for that. Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|