|
Hi,
I busy fixing a Addin for Visual Studio.
Basically generating a source file.
The class with its methods get generated fine, but
when I save the generated source it get additional closing brackets.
This line cause additional bracket to be inserted:
applicationObject.ActiveDocument().Save("");
Can anyone please tell me why?
Regards
Full Code:
<br />
TextSelection testSelection = applicationObject.GetActiveDocument().Selection as TextSelection; if (testSelection != null)<br />
{<br />
testSelection.SelectAll();<br />
<br />
string val = GenerateCode(targetNamespace,targetClass, testClassName);<br />
<br />
testSelection.Text = val; <br />
}<br />
<br />
applicationObject.GetActiveDocument().Save("");<br />
<br />
|
|
|
|
|
Don't worry, fixed it myself.
Was related to TextSelection and Resharper being clever.
When assigning TextSelection.Text, Reshaper try to insert the correct
matching brackets.
The right use for TextSelection is to use the Insert method.
testSelection.Insert(val, (int)vsInsertFlags.vsInsertFlagsInsertAtStart);
|
|
|
|
|
Hi,
.net 2 vs2005
I have a winform app that uses visual inheritance and connects to a web service.
The problem I have is that when I close the app it still runs in task manager.
When it runs through visual studio on clicking close it closes but i still need to select the stop button in visual studio.
Ive tried base.Close() before calling this.close() and setting the web service object to null, there are no threads I am aware of - how can i find out what is still running?
ive also tried Application.Exit(); in program.cs but again this makes no difference.
Thanks,
Chas
|
|
|
|
|
In your application main page write Application.Exit() in the page dispose event...
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
Application.Exit();
}
Thanks
Hem
|
|
|
|
|
I was helping with this question[^] and decided to actually try out my advice.
Basically, the OP wants to add a load of images to a form, but it takes some time and he wants the form to remain responsive. I suggested using User32.PostMessage with a user message to add each image. After an image has been added, post the message again to do the next image.
What I expected to happen was that any windows messages that were posted to the message queue while an image was being added, would be handled before the next user message was pumped. This appears not to be the case. It seems the windows messages don't get through until all the user messages have been pumped. So, the form is still unresponsive during this time.
My question is: can anyone explain this to me?
This is in my Form . I have simulated adding images with setting a label's text lots of times:
const int MSG = 0x0400;
Queue<int> _Queue = new Queue<int>();
protected override void WndProc( ref Message m )
{
if ( m.Msg == MSG ) AddImage();
base.WndProc( ref m );
}
private void button1_Click( object sender, EventArgs e )
{
for ( int i = 0 ; i < 1000 ; i++ ) _Queue.Enqueue( i );
Pulse();
}
private void Pulse()
{
Refresh();
if ( _Queue.Count > 0 ) User32.PostMessage( Handle, MSG, 0, 0 );
}
private void AddImage()
{
if ( _Queue.Count > 0 )
{
int i = _Queue.Dequeue();
for ( int x = 0 ; x < ( int ) 1e4 ; x++ )
label1.Text = "hello " + i;
}
Pulse();
}
The interesting method is Pulse . I understand the need for Refresh ( because WM_PAINT messages are deferred ), but I don't understand why the nasty Application.DoEvents() is required.
Thanks
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Have you tried BeginInvoke?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Yes, tried that - same results
----------------------------------
Be excellent to each other
|
|
|
|
|
Oh well, easy come, easy go
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
True, true. Thanks leppie
He seems to have got it working with a BackgroundWorker anyway.
----------------------------------
Be excellent to each other
|
|
|
|
|
Hi,
I am trying to connect with Microsoft Exchange Server using the following code
static void Main(string[] args)
{ {
System.Net.ServicePointManager.ServerCertificateValidationCallback =delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
};
ExchangeServiceBinding objExchangeServiceBinding = new ExchangeServiceBinding();
objExchangeServiceBinding.Credentials = new System.Net.NetworkCredential("user", "pass", "domain.com");
objExchangeServiceBinding.UseDefaultCredentials = true;
objExchangeServiceBinding.Url = "https://10.11.1.250/ews/Exchange.asmx";
FindItemType request = new FindItemType();
request.ItemShape = new ItemResponseShapeType();
request.ItemShape.BaseShape = DefaultShapeNamesType.Default;
request.Traversal = ItemQueryTraversalType.Shallow;
request.ParentFolderIds = new BaseFolderIdType[1];
DistinguishedFolderIdType inbox = new DistinguishedFolderIdType();
inbox.Id = DistinguishedFolderIdNameType.inbox;
request.ParentFolderIds[0] = inbox;
ServerVersionInfo objServerVersionInfo = objExchangeServiceBinding.ServerVersionInfoValue;
}
But I get the following error
“The request failed with HTTP status 401: Unauthorized.”
Can anyone please tell me what the problem is? I will be thankful to you
regards,
|
|
|
|
|
Please check your Network credential.if possible then login to OWA from this credential for varification.
Cheers!!
Brij
|
|
|
|
|
Thanks for your reply, I can login to OWA using the same username, password and domain, but it creates problem when I try it through code as I mentioned.
|
|
|
|
|
Hello World!
How can I change the screen resolution in c#?
Thanks
|
|
|
|
|
Google not working for you?
|
|
|
|
|
hi,
how to read .ttf fontfiles for getting width & height of text in wpf using c#...
plz reply
|
|
|
|
|
Are you trying to find the width of a string? If so you can use MeasureString from a Graphics object
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Ya i want the width of the string...
I think MeasureString from a Graphics object cant be used in wpf ...It can be used only with forms...
I tried this
Graphics g =(this).CreateGraphics();
creategraphics method does not exists because it is not a form so
Any other way is there to know from font file
|
|
|
|
|
Hello all,
How can I communicate with a scanner device and scan a picture and save it and so on?
T.I.A
While (true)
|
|
|
|
|
It is tough unless scanner provides some API
|
|
|
|
|
Can you give me an example? I searched Google and MSDN but I couldn't find anything. Please Help!
|
|
|
|
|
See this article: http://www.codeproject.com/KB/dotnet/twaindotnet.aspx">http://www.codeproject.com/KB/dotnet/twaindotnet.aspx
Kutty
|
|
|
|
|
I have a question regarding STA/MTA in .net
I need to build a COM object in .net whose threading model is required to be STA only (not Both,..) because it is not safe to be used in MTA apartment.
How to do it?
Thank you very much!
|
|
|
|
|
Hi,
I want to develop a page in asp.net in which when user type any word the list of corresponding words or list of words starting with that char should display in the drop down and user must able to select that.
for example Visual Studio when we type any word and press ctrl+space bar the list of words appears. i want to do the same.
|
|
|
|
|
YOUR IN THE WRONG FORUM!!!!
try the ASP.Net Forum
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Hello,
There is internal feature of .NET that we can generate Report from comments.
Can anybody give any idea, how to do this.
Thanks
|
|
|
|