System.ComponentModel.Win32Exception: The operation completed successfully
Hi,
I wrote a form that and behaves a lot like the desktop alerts in
Outlook 2003 (fades in and out unobtrusively), then filled it with
current condition weather data (www.weathercorneralert.com). I'm
having the oddest exception that I can't track down. The app refreshes
current conditions hourly (with a System.Windows.Forms.Timer). If I
put my computer in stand by or hibernate, then bring it back up, I
often get the following exception (type, message and stack trace):
System.ComponentModel.Win32Exception
The operation completed successfully
at System.Windows.Forms.Form.UpdateLayered()
at System.Windows.Forms.Form.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmCreate(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
This is the _entire_ stack trace. Note the lack of any user code in
the stack trace. Also note that this build is built in debug mode; I
was hoping to get some line numbers. I get the same thing when I build
in release mode.
I'm clueless as to how to prevent this exception from being thrown.
I'm almost at the point where I'll just catch a Win32Exception in my
Application.ThreadException handler and swallow it.
Can anyone offer any suggestions? Thanks a lot in advance,
Travis Tag: Wallpaper Tag: 73276
Using 'as' for value types...
In many occasions I found code like this (especially in Microsoft's code)
object obj1
num1 = 0
[...
if ((obj1 as short) != 0
num1 = ((short) obj1)
But when I try to do it I get an error on (obj1 as short) saying that "The as operator must be used with a reference type ('short' is a value type)
So how come it works for others but not for me
Thanx Tag: Wallpaper Tag: 73275
german errortext in System.Exception
Hi,
hope somebody can help me. After some updates and patches my SystemExeption
switched to german language.
how can i switch back to english?
thx for your help
============================================================================
=====
An unhandled exception of type
'System.Runtime.Serialization.SerializationException' occurred in
mscorlib.dll
Additional information: Die Serialisierung deserialisert keine Delegate zu
nicht öffentlichen Methoden.
============================================================================
===== Tag: Wallpaper Tag: 73274
ngen.exe sngen(?).exe XML Serialize
Hi
We have a problem. We have a class that we ask the .net Framework for a Serialize class and then we use it. But we have the problem that a compilation is happen every first time
We have heard of a tool that is to be released tha is some a variant of ngen.exe, the new name should be something like sngen.exe(?). (Should be a part of Widbley???
Does anyone know abything about this here? Is it possible to get a beta somewhere
Regard
/Marcu Tag: Wallpaper Tag: 73273
Com Port Listener. Please Help Me.
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C4247A.84C157D0
Content-Type: text/plain;
charset="windows-1256"
Content-Transfer-Encoding: quoted-printable
Hi,
How can I read data from com port in csharp.
Best Regards,
Amin.
------=_NextPart_000_0008_01C4247A.84C157D0
Content-Type: text/html;
charset="windows-1256"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1256">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>How can I read data from com port in=20
csharp.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Best Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Amin.</FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01C4247A.84C157D0-- Tag: Wallpaper Tag: 73270
Getting MX Records With .NET Framework?
The Dns class allows you to lookup IP addresses or domain names. Is there a
way to use the .Net Framework to lookup MX records?
Thanks. Tag: Wallpaper Tag: 73267
PocketPC 2003 unable to get device ID using KernelIoControl
Hi,
I can not get the device ID of PocketPC 2003 devices. I have been
using the code at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/retrievedeviceid.asp
The KernelIoControl call always returns a status of
ERROR_INSUFFICIENT_BUFFER. It tells me that the required buffer size
is 36, but gives this error even when I set the buffer size to 36.
I read in another post that it has something to do with PocketPC 2003
apps running in user mode only, which does not give me the permission
to call KernelIoControl? If thats the case, is there any way in
PocketPC 2003 to get a device ID?
Any help would be greatly appreciated.
Thanks,
Tony Tag: Wallpaper Tag: 73263
Interactive Windows Service
Hi
Is there a way in C# to programmatically set the interactive flag for a windows service (so to have the service installed with the right settings without need to manually modify them)
thank
traxxx Tag: Wallpaper Tag: 73261
A simple Text Template tool
Hi,
I was trying to use Galois.Net to specify code generators and I had to look for
some text template tool to simplify the syntax. I was looking for something similar
to the syntax of an Asp.Net page; for example, a template file could look like
the following:
<%@ Assembly Name="ReturnString.dll" %>
<html>
<title>Testing generator</title>
<body>
<p>
Hello <%= ReturnString.Val() %>
<p>
</body>
</html>
and if the ReturnString.dll is compiled from the following code:
public class ReturnString {
public static string Val() {
return "World";
}
}
we should expect the output to be:
<html>
<title>Testing generator</title>
<body>
<p>
Hello World
<p>
</body>
</html>
I wrote such a tool and I decided to post here because it might save
other people a few hours of works since it was not completely trivial.
Galois.Net can be found at http://www.a2ii.com/galois/index.htm .And
using it to specify code generators, I have the impression that "I'm going
places".
I haven't done much testing but it was sufficient for my need. To use
it, you should compile the code below e.g. "csc TextTemplateTool.cs".
And run it, with the command: "TextTemplateTool hello.txt" where
you saved the template text above in a file named "hello.txt". (You
should also have compiled the ReturnString.dll assembly i.e.
csc /out:library ReturnString.cs). NOTE: the "code behind" facility
expect the dll to be in the same directory as the application).
I have tried to keep the code to a strict minimum. You shouldn't
have problems extend it to suit your needs.
Cheers,
-daniel
========================
Daniel Perron, Ph.D.
Lead Developer, Galois.Net
+++++++++++++++++++++++++++++++++++++++++++++++
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Collections;
using System.Reflection;
using System.CodeDom.Compiler;
using Microsoft.CSharp;
class TextTemplateTool {
//the code that is included at the beginning of
//every program
static string prologue = @"
using System;
using System.Collections.Specialized;
public class _templateGeneration
{
public static void Main()
{
";
//the code that is included at the end of
//every program
static string epilogue = @"
}
}
";
public static void Main( string [] argv ) {
StreamReader rd = new StreamReader( argv[0] );
string input = rd.ReadToEnd();
StringBuilder buffer = new StringBuilder();
buffer.Append( prologue );
//assemblies will contain the list of referenced
//assemblies used in the template
ArrayList assemblies = new ArrayList();
//This regex will be used to identify the processing code
//in the template; we'll be looking for the string <% ... %>.
//To allow for code spanning multiple lines, we want to let
// the . in a regex to match a end of line so we use the given option
Regex exp = new Regex( "(<%.*?%>)", RegexOptions.Singleline );
string [] chunks = exp.Split( input );
string cleanup;
for( int i = 0; i < chunks.Length; i++ )
{
if( chunks[i].StartsWith("<%=") )
{
cleanup = chunks[i];
cleanup = cleanup.Substring(3,cleanup.Length-5);
buffer.Append( string.Format("Console.Write({0});", cleanup.Trim() ));
}
else if( chunks[i].StartsWith("<%@" ) )
{
//we want to get the name of the assembly
//inside the "..."
Regex asm = new Regex( "\".*\"" );
cleanup = asm.Match( chunks[i] ).Value;
cleanup = cleanup.Substring(1,cleanup.Length-2);
//we allow to use "code behind" from assembly in
//the same directory as the application
string path = AppDomain.CurrentDomain.BaseDirectory;
assemblies.Add( path + cleanup.Trim() );
}
else if( chunks[i].StartsWith("<%") )
{
cleanup = chunks[i];
cleanup = cleanup.Substring(2,cleanup.Length-4);
buffer.Append( cleanup.Trim() );
}
else
{
buffer.Append( string.Format("Console.Write(@\"{0}\");", chunks[i] ));
}
}
buffer.Append( epilogue );
//get ready to generate an assembly
CSharpCodeProvider provider = new CSharpCodeProvider();
ICodeCompiler compiler = provider.CreateCompiler();
CompilerParameters options = new CompilerParameters();
options.GenerateInMemory = true;
options.GenerateExecutable = true;
options.ReferencedAssemblies.Add("System.dll");
if( assemblies.Count > 0 )
foreach( object asm in assemblies )
options.ReferencedAssemblies.Add( (string)asm );
CompilerResults results = compiler.CompileAssemblyFromSource(options,
buffer.ToString());
if (results.Errors.Count == 0)
//if there is no error run the generated program
//that will write to the console the template with
//the given substitution
results.CompiledAssembly.EntryPoint.Invoke(null, null);
else
Console.WriteLine("*** Syntax Errors ***");
}
} Tag: Wallpaper Tag: 73257
Problems running apps on Citrix for non-admins
My managed WinForms application is running fine on Citrix when logged
in as
a local administrator. When running it as a normal user, it seemed
not to
even start. To diagnose the problem, I wrote a simple HelloWorld
WinForms
app that has the exact same behavior.
To continue the investigation, I ran SysInternal's FileMon program
which
revealed that a drwatson.log and user.dmp file were being created.
Apparently when an regular user runs a .NET app on our Citrix server,
a
stack overflow is occurring. Has anyone got any ideas. I'd be happy
to forward anyone interested the drwatson log file. Tag: Wallpaper Tag: 73255
How to get gdiplus.dll folder?
Hi, there
I have a Win32 app that uses GDI+. For WindowsXP, my app cannot find gdiplus.dll, since it is not installed in system folder. I was wondering if any one would know how do I get the name of the folder that gdiplus.dll is installed using some API calls, or do I have to hard code the folder name to find the dll
Thanks for your help
Michael Tag: Wallpaper Tag: 73247
RichTextBox flicker solved
The RichTextBox control in .NET (1.1) seems to have a flicker problem. A
search of google revealed a lot of advice to remove flicker when
reformatting and coloring the text, but no one seems to know how to remove
the flicker when you simply enter text and there's more than about a
thousand characters. To see this problem, drag a rich text box onto a form.
Make it around 600 by 600 pixels, and turn the font up to 12 pt. Run the
program and enter four or five lines of text. You get a lot of flicker on
any further edits, and the problem gets worse as the control gets bigger and
the length of text gets higher.
The answer seems to be to add this code to a subclass of RichTextBox, which
throws away a particular event. I'm not sure how it works, and YMMV, but my
homegrown MySQL based personal journal software is now much more pleasant to
write in.
class FlickerFreeRichTextBox : RichTextBox {
protected override void WndProc(ref Message m) {
if ((m.Msg != 0x2111) || ((((uint)m.WParam >> 16)
& 0xFFFF) != 768))
base.WndProc(ref m);
}
}
I'm only posting this because I had quite a time finding the answer, and I
thought this would make it easier for future seekers.
It's amazing a bug this big got into the framework. Well, appalling, at
least.
Chris Capel Tag: Wallpaper Tag: 73244
When in the heck is a .NET 1.1 Service Pack coming!!!!!!!!!!
And/Or maybe a Visual Studio 2003 Service Pack. I encounter too many
unnacceptable bugs especially with User Controls.
Does anyone know when one will come! Not saying this will solve all my
problems, but it's about time for a service pack!!!!!!
-dave Tag: Wallpaper Tag: 73243
Disable Dropdown into a Datagrig
Hello All,
I hope someone can help me, I need disable a dropdown into a datagrid every time I checked a Html checkbox button. Is it possible?
thanks in advance
--------------------------------
From: Altair Costa
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>qJotRWszNU+dx2KGl2NeDQ==</Id> Tag: Wallpaper Tag: 73233
Com
Hi,
I wrote an assembly in c# and i need to use it in my vc++ project so i build
a tlb from it using regasm.exe and import it in my project i also put the
dll under the directory of my exe file but it failes when i try to all the
createinstance function why???
It work fine in my xp computer when i develop it but when i install it in
another computer i get error access denined in the create instance why???
now in my dev computer i get the same problem i try to register the dll in
the GAC but it didnt help (do i must reg assembly dll`s in the gac for
inerop??)
can you tell me the correct steps to connect assembly dll from unmanage code
using com???
Thanks Tag: Wallpaper Tag: 73232
XML files
Hi,
I am writing an ATL com object in VC-7 and please somone can tell me how can
i read an xml file using the atl or vc++ function`s???
Thanks Tag: Wallpaper Tag: 73231
Out of Memory
Hi
i am developing an aplication in VB.NET and i have a functionality that allows users to process some images. When users processes several (big) images (imagine 5 images with 50M each), it return the message "Out of memory" and the image that it was processed is losted and the aplication process the next one...
is possible resolve or attenuate this problem without add more memory?
is possible to increase memory virtual machine of the .NET platform??
i appreciate some hel
best regard
Celest Tag: Wallpaper Tag: 73228
Building satellite assemblies where the template is strong named
I need for our customers to be able to generate satellite assmblies for use in our application. The template assembly from which the satellite assemblies are based on is strong named. It seems that the private key is needed in order to generate satellite assemblies. I'm not about to distribute our private key to our customer so that they can generate satellite assemblies. Is this supposed to be how it works? How can I get around this? Tag: Wallpaper Tag: 73222
What does GC.GetTotalMemory really tell us?
Jon Skeet posted some code in another thread using the
GC.GetTotalMemory(true) method as a way to demonstrate the amount of memory
being allocated for a certain data type.
That method was new to me and I thought it looked like a great simple way to
implement some general memory monitoring. So I put a timer on my Mdi parent
form and had it display the results of that call every couple of seconds.
When the results were pretty weird compared to what I expected, I wrote the
following console app. I think I understand why the results do what they do
except:
- Why the big 11k jump when the hog is created? Is that mostly the
MemoryHog class itself?
- Why the jump and not drop when hog is set to null?
Also, if I understand the documentation for passing true in the parameter,
doing so doesn't necessarily guarantee collection of all generations, only
whatever can be done in a preset amount of time. Not that it probably
matters in my scenario, but just for my curiosity.
--------------------
using System;
using System.IO;
namespace JunkConsoleApp
{
public class TestClass
{
public static void Main()
{
long howMuchBefore = 0L;
long howMuchDuring = 0L;
long howMuchAfter = 0L;
long memorybeforeCall = 0L;
long memoryAfterCall = 0L;
howMuchBefore = GC.GetTotalMemory(true);
Console.WriteLine("Memory Before:\t\t{0}", howMuchBefore);
MemoryHog hog = new MemoryHog();
howMuchDuring = GC.GetTotalMemory(true);
Console.WriteLine("Memory with hog:\t{0}", howMuchDuring);
hog = null;
GC.Collect(GC.MaxGeneration); // Just to be absolutely sure!
GC.Collect(GC.MaxGeneration);
howMuchAfter = GC.GetTotalMemory(true);
Console.WriteLine("Memory After:\t\t{0}", howMuchAfter);
Console.WriteLine(new string('-', 50));
memorybeforeCall = GC.GetTotalMemory(true);
Console.WriteLine("TestMethod-Before call: \t{0}", memorybeforeCall);
TestMethod();
memoryAfterCall = GC.GetTotalMemory(true);
Console.WriteLine("TestMethod-After return:\t{0}", memoryAfterCall);
Console.WriteLine(new string('-', 50));
memorybeforeCall = GC.GetTotalMemory(true);
Console.WriteLine("TestMethod-Before call: \t{0}", memorybeforeCall);
TestMethod();
memoryAfterCall = GC.GetTotalMemory(true);
Console.WriteLine("TestMethod-After return:\t{0}", memoryAfterCall);
Console.WriteLine(new string('-', 50));
Console.WriteLine("Press a key");
Console.Read();
}
public static void TestMethod()
{
long memoryAtStart = 0L;
long memoryWithHog = 0L;
memoryAtStart = GC.GetTotalMemory(true);
Console.WriteLine("TestMethod-Start:\t\t\t{0}", memoryAtStart);
MemoryHog hog = new MemoryHog();
memoryWithHog = GC.GetTotalMemory(true);
Console.WriteLine("TestMethod-With hog:\t\t\t{0}", memoryWithHog);
}
}
class MemoryHog
{
private string s1 = "hello";
private string s2 = "hello";
private string s3 = "hello";
private string s4 = "hello";
private string s5 = "hello";
}
} // namespace JunkConsoleApp Tag: Wallpaper Tag: 73219
Treeview issue
I am working in C# .NET
If I want to invoke LabelEdit event of TreeView/ListView(property set to
true) from another event what should I do?
I was advised to send a LVM_EDITLABEL / TVM_EDITLABEL message to the
control.
But how to get the integer number for LVM_EDITLABEL / TVM_EDITLEVEL ? Or
which namespace/ref I need to add to direct access of the const value.
Please help me. Is there any way to get all those constants' hex value? Tag: Wallpaper Tag: 73218
How do I retrieve the Control Type Name?
I am writing an application (in C++) to interrogate the controls on any
currently running .NET application. Most of the information I need I can
retrieve from the window and class information available through the HWNDs
retrieved using the EnumChildWindows() API.
My problem occurs with controls that have the class name like
'WindowsForms10.BUTTON.app3'. So far I have seen this class name used for
button, checkbox, radio button and group box controls, and basically all the
other windows' styles are the same for each control type. The only way to
distinguish these controls is by the control type name, and as far as I can
see this property cannot be accessed from an external process.
However I have noticed that at runtime controls within a .NET application
seem to have a property/variable called 'WM_GETCONTROLNAME' which appears to
me to be a type of windows message. Sending this value as a windows message
to a .NET control has no effect.
Could someone please tell me if this WM_GETCONTROLNAME can provide me with
the functionality I need or do I need to inject my own code into the running
process in order to retrieve the information I need from the inside???
Thanks in advance...
Mike
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 15/04/2004 Tag: Wallpaper Tag: 73209
Adding com reference on the fly
Is there a way I can add a reference to a component on the fly in C#?
I'm adding a reference to Microsoft Word, but I want to add the
reference to the version the user is running. I have Office 2003 myself,
but unless I distribute the com.interop assemblies this makes it won't
work on another Office version.
So I'd like to check what version the user has, and use interop towards
that version.
The functions I use are the same for 2000, XP and 2003.
Guess I could install Office 2000 and add those, and it would work on
all newer versions, but that's not as elegant :)
-m Tag: Wallpaper Tag: 73208
Debugger Problem in c#
Hello,
I´m using the .Net Framework 1.1. When i´m using the debugger it stoped at a breakpoint, but the Studio hang then I cannot edit the sourcecode any more and the debugger-windows do not show any informations.
I have allready deleted all created dll´s and restart the computer. The first run of the debugger seemed to be ok, but the second run hang again.
I also tried this on an other PC, where the same things happend.
Can s.o. help me or have the same problem?
Regards,
Rainer Langohr Tag: Wallpaper Tag: 73201
Nasty No-touch Deployment Problems
Dear Al
Iâ??d be grateful for any suggestions as to how I might solve some nasty problems Iâ??m having with no-touch deployment (NTD) of WinForms applications.
The problems are on two more-or-less identical production Windows Server 2003 machines that have recently undergone lots of changes â?? mainly centred around the installation of Macromediaâ??s JRun 4 and ColdFusion MX products to support a third-party application my organisation has bought
The first problem is that following these changes, my WinForms apps that have previously worked fine using NTD now cause a File Download dialogue box to appear on the client PC rather than the application main form. To get the application to appear users have to pretend to save the EXE (by clicking on Save then clicking on Cancel when the Save As dialogue appears) after which calling the URL again results in the application main form being displayed - but only for that session. (On a test server that has not been subjected to all the changes the application behaves as expected with NTD.
The second problem is that I now want to deploy an application that uses a custom DLL. This application works fine on a test server, but when I move it to one of the production machines with an identical setup as far as the virtual directory is concerned the .NET Framework throws a System.IO.FileNotFoundException, saying that â??File or assembly name MyCustomDLL, or one of its dependencies, was not found.â?
It would seem that the configuration changes to the production servers are the cause of the problems, but I'm at a loss as to how I might track down the specific change. Iâ??ve tried uninstalling and reinstalling ASP.NET with aspnet_regiis but still no joy. My next thought was to uninstall and reinstall the .NET Framework, but of course itâ??s built-in to WS 2003 and the only way to repair seems to be an in-place upgrade which I donâ??t want to have to do on production servers. Iâ??m pulling my hair out on this one so all suggestions as to what further investigations I might conduct gratefully received
Thanks very much - Graham Tag: Wallpaper Tag: 73200
VB.Net With Statement
Hi,
Please could someone let me know if there is a equivalent command for C#
ie
vb.net
with object
.
.
.
end with Tag: Wallpaper Tag: 73196
Strong Name for VB COM dll
Hi,
I have a VB COM dll (lets name A) which references another VB COM
dll(lets name B).
I created an assembly for A dll named NETA.dll using tlbimp and then I
want to assign it a strong name and sign it and put it in GAC.
I generated key using sn utility named Akeyfile.sn
When I try to strong name it and sign it using VS.NET
[assembly: AssemblyTitle("NETA.dll")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("C:\\Akeyfile.sn")]
it returns me an error that
Assembly generation failed -- Referenced assembly 'NETA.dll' does not
have a strong name.
How am I supposed to strong name it and sign it?
And do I need to give strong name to Vb COM dll 'B' too? If yes then
how will I strong name both of them using VS.NET.? Tag: Wallpaper Tag: 73193
How to automate modifying IE security settings.
Hi there
I am developing an application where in I need to launch a "Client exe" (.NET Winform app) from a Web page (which could be either in an Intranet/Intranet application).
I am able to successfully launch the executable using javascript, using the following code ......
function OpenExe(
{
var os = new ActiveXObject("WScript.Shell")
var params = "C:\Test.exe param1 param2"
var s = os.Run(params)
return
But to achive the following I need to Manually enable the IE security setting â??Initialize and script ActiveX controls not marked as safeâ?? in the respective zone.
My Question is:"How can I automate this Manual process of modifying the IE security settings ?
thanx in advance
Saurab Tag: Wallpaper Tag: 73191
Rollback transaction doesnt work when DataAdapter.Update() throws exception caused by RAISEERROR in a trigger
Hi,
I have a trigger like this (simplified to illustrate the problem):
--------
CREATE TRIGGER Test ON [dbo].[TestTable]
FOR INSERT, UPDATE, DELETE
AS
RAISERROR( 'test trigger error !', 16, 1)
---------
And a C# code portion: (new record inserted in dsFormTest.TestTable)
---------
OdbcTransaction odbcTrans = null;
try {
if ( odbcConn.State != ConnectionState.Open ) odbcConn.Open();
odbcTrans = odbcConn.BeginTransaction();
odaTest.InsertCommand.Transaction = odbcTrans;
odaTest.Update( dsFormTest.TestTable );
odbcTrans.Commit();
}
catch( Exception xc ) {
if ( odbcTrans != null ) odbcTrans.Rollback();
MessageBox.Show( xc.ToString() );
}
odbcConn.Close();
----------
BUT, instead of rolling back transaction, the odbcTrans.Rollback() throws
new exception with message:
System.InvalidOperationException: RollbackTransaction requires an open and
available Connection. The connection's current state is Open, Fetching.
any clues why? Tag: Wallpaper Tag: 70684
Code Template
I want to modify the code generated by the C# Windows Application Project. I
think I have to deal with the code template of that. Or can I create a new
project type?
I 've tried to find some information of that. Unfortunately, I cannot find
material I want.
--
My C++ and C# (Traditional Chinese) Site :
http://www.franzwong.com/Programming Tag: Wallpaper Tag: 70664
Possible bug in the XsltCompileException and XslTransform classes
Greetings
When checking for an Xslt Compile Exception, I found the message property did not contain the complete message. Instead there was an inner exception of type XsltException that contained the correct message, but zero for the line and postion properties. Here is the output from my debug statements
XsltCompileException Message Contents: (5,2)
XsltCompileException Message Length:
XsltCompileException Line Number:
XsltCompileException Line Position:
XsltCompileException InnerException Message Contents: './Exception' is an invalid XPath expression
XsltCompileException InnerException Message Length: 4
XsltCompileException InnerException Line Number:
XsltCompileException InnerException Line Position:
Below I have included the XSL style sheet and the code I was using.
Question:
Is this a bug in the framwork, or did I miss something when I was reading the SDK documentation?
Cheers
John
-----------------------------------------------------------------------------------------------------------------------------------------------------
Here is the style sheet I was using
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"><xsl:output method="text" /><xsl:template match="./Exception"
using System
namespace DMH.Framework.Dat
/// <summary
/// The exception that is thrown when <xsl:value-of select="Description" /
/// </summary
public class <xsl:value-of select="Name" />Exception : GeneralExceptio
public <xsl:value-of select="Name" />Exception():base(){
public <xsl:value-of select="Name" />Exception(string message):base(message){}
public <xsl:value-of select="Name" />Exception(string message, Exception ex):base(message, ex){}
public static string FormatMessage(<xsl:apply-templates select="Parms" mode="MethodArgs" />
return String.Format(" <xsl:value-of select="MessageString" />", <xsl:apply-templates select="Parms" mode="MessageArgs" />);
public override int ErrorNumbe
get {return <xsl:value-of select="ErrorNumber" />;
</xsl:template><xsl:template match="Parms" mode="MethodArgs" ><xsl:apply-templates select="Parm" mode="MethodArgs" /></xsl:template><xsl:template match="Parm" mode="MethodArgs"><xsl:text>string </xsl:text><xsl:value-of select="." /><xsl:if test="position()!=last()">, </xsl:if></xsl:template><xsl:template match="Parms" mode="MessageArgs" ><xsl:apply-templates select="Parm" mode="MessageArgs" /></xsl:template><xsl:template match="Parm" mode="MessageArgs"><xsl:value-of select="." /><xsl:if test="position()!=last()">, </xsl:if></xsl:template></xsl:stylesheet
----------------------------------------------------------------------------------------------------------------------------------------------------------
Here is the code snip
StringReader sReader = new StringReader(this.XSLText.Text);
XmlTextReader xReader = new XmlTextReader(sReader)
//Load the stylesheet
//Create a new XslTransform object
XslTransform xslt = new XslTransform()
tr
xslt.Load(xReader);
catch(XsltCompileException ex
Debug.WriteLine(ex.Message, "XsltCompileException Message Contents");
Debug.WriteLine(ex.Message.Length, "XsltCompileException Message Length")
Debug.WriteLine(ex.LineNumber, "XsltCompileException Line Number");
Debug.WriteLine(ex.LinePosition, "XsltCompileException Line Position")
if(ex.InnerException != null && ex.InnerException is XsltException
XsltException iex = (XsltException)ex.InnerException;
Debug.WriteLine(iex.Message, "XsltCompileException InnerException Message Contents");
Debug.WriteLine(iex.Message.Length, "XsltCompileException InnerException Message Length")
Debug.WriteLine(iex.LineNumber, "XsltCompileException InnerException Line Number");
Debug.WriteLine(iex.LinePosition, "XsltCompileException InnerException Line Position") Tag: Wallpaper Tag: 70663
.Net Codepage 850 problem with uppercase accented characters
Hi. I have a problem using ASP.Net or VB.Net (Winforms) accessing an Oracle database that uses WE8PC850 (which is the IBM-PC codepage 850) character set. Our older ASP apps work fine with this database, but the three different ASP.Net and VB.Net Winforms test apps we have developed so far do not display uppercase French accented A and E characters correctly
I have tried all the potential codepages that seem appropriate: IBM850, IBM863, Windows-1252, ISO-8859-x, utf-8, utf-16 and so forth. The closest seems to be IBM850 reponse and request encoding with the response.charset set to Windows-1252, or ISO-8859-1. As all of the ASP apps work fine and display the codepage 850 uppercase accented characters correctly on our three different desktops we have tried so far, it has to be a problem with the .Net managed provider for Oracle / the .Net codepage 850 implementation, as the same Oracle 8.1.7 client software is used for both the ASP and .Net applications on the client
Because of this Oracle refuses to look into the matter, gleefully pointing out that it must be a Microsoft problem! :
We have tried bland, vanilla test apps in .Net and the problem is always there. None of the older ASP apps (that just use defaults for character sets and codepages etc.) have any problems. All of the desktops have the NLS_LANG parameters set correctly and it DOES seem to be a Microsoft, .Net-specific problem
I have tried MSDN and web searches to no avail up to yet. Having wasted two to three days trying different solutions, I am now desperate for "official" assistance from Microsoft. I am working for AMITA Corp (Ottawa, Canada) and they are a Microsoft Solution Provider, so hopefully we can get some support on this, as we are now almost certain that it IS a .Net bug in the IBM850 codepage support in .Net. Any and all help is greatly appreciated. The Oracle DBA's have washed their hands of the matter and are suggesting we forget about .Net and revert to using Oracle whatever's! Of course we do NOT want to accede to that suggestion!!! ;
Can anyone from Microsoft (or anywhere else for that matter) help out here
Barrie Gray Tag: Wallpaper Tag: 70661
NTFS
How can I tell if this PC is a FAT32 or NTFS? I can load VS.NET without NTFS and not certain if I do or don't or how to convert all to NTFS. Can you help? Tag: Wallpaper Tag: 70658
running media player from a browser.
hiye, my project involves playing videos from web browser. any good tutorial to get that done
thanks in advance. Tag: Wallpaper Tag: 70651
Framework Version 1.1
Hi all
I have installed on my machine Framework Version 1.0 can anybody guide me
how to upgrade it to Framework Version 1.1 .
Regards
Mohamed Afifi
Web Developer Tag: Wallpaper Tag: 70646
Is this a bug in ?: Operator, the addition does not perform as expected
I am posting the code snippet here. It seems to me that the ?:
Operator is not behaving properly. It seems like it is a bug:
TimeSpan ts1, ts2;
float dayHours = 0;
ts1 = (some_datetime_variable_1);
ts2 = (some_datetime_variable_2);
// ****************** Working Code *************************
// This computes dayHours correctly
if(ts1.TotalHours > 0)
dayHours = (float)ts1.TotalHours;
if(ts2.TotalHours > 0)
dayHours += (float)ts2.TotalHours;
// ****************** Working Code *************************
// ****************** Non-Working Code *************************
// This does not add the portion after + sign
dayHours = (float)(ts1.TotalHours > 0 ? ts1.TotalHours : 0 +
ts2.TotalHours > 0 ? ts2.TotalHours : 0);
// ****************** Non-Working Code *************************
As commented above, I am trying to condense the working code to one
line using ? operator but the one line non-working code dows not add
the variable after + sign. For example, if ts1.TotalHours is 4 and
ts2.TotalHours is 3, the dayHours is computed as 4. Though, I can use
the working code, which takes four lines but it is something I am
doing wrong here or it is a bug in .NET Framework?
Thank you for your time for looking at my post and would appreciate
your responses.
R. Kaushik Tag: Wallpaper Tag: 70639
Attribute Construction/Validation, How?
Hi,
I am trying to writing my own custom attribute classes and would like to
have the same level of functionality as some of the attribute classes that
ship with the .NET Framework.
Specifically I would like to be able to take action with my attribute at
compile time.
For example, the Guid Atribute will give you this error at compile time if
you attempt to using it with an improperly formatted string:
[Guid("garbage string")]
public class Test
{
}
Yields the compiler error:
'Incorrect uuid format.'
Another example of attributes taking action at compile time is the
ComImportAttribute. Attempting to use this attribute by itself causes the
following to happen:
[ComImport]
public class AnotherTest
{
}
Yields the following two compiler errors:
'The Guid attribute must be specified with the ComImport attribute'
'A class with the ComImport attribute cannot have a user-defined
constructor'
I would really like to have this kind of flexibility with my own custom
attributes. Is this at all possible?
I sadly suspect the answer is no. As a matter of fact, it seems as if user
defined attributes can only be accessed (and only invoked once reflected) at
runtime.
If this is not the case, could someone explain how it is possible to take
action with user defined attribute at compile time, and even load time?
Thanks in advance. Tag: Wallpaper Tag: 70637
.cs expansion in solution explorer for WindowsForms?
I've noticed that when I'm programming Windows applications in the .net
sutdio I can't see an expansion option in the Solution Explorer to get
the .cs behind the WindowsForm. In contrast, I can get the code behind
an aspx in the Explorer pretty easily. I know I can select 'View Code'
etc but it's like, I don't want to have to do this, I want the .cs for a
form right there, ready to play with, in code view.
Any ideas?
--
One framework to rule them all...
@@@ @@@ @@@@@@ @@@@@@@ @@@@@@@ @@@ @@@ @@@ @@@@@@
@@!@!@@@ @@! !@@ @@! @@@ @@! @@! @@@ !@@
@!@@!!@! @!!!: !@! @!@!!@! !!@ @!@ !@! !@@!!
!!: !!! !!: :!! !!: :!! !!: !!: !!! !:!
:: : ::: :: :: :: : : : : : :.:: : ::.: :
n3crius > .net programmer (c#/asp.net) Tag: Wallpaper Tag: 70633
XmlValidatingReader ERROR !!!!
Hi,
I need to validate a XML Document using the W3C XForms Schema.
I'm doing it like this
reader = new XmlValidatingReader(xml, XmlNodeType.Document, null);
reader.Schemas.Add(XmlSchema.Read(
new FileStream("XML-Events-Schema.xsd", FileMode.Open), null));
reader.Schemas.Add(XmlSchema.Read(
new FileStream(@"XForms-Schema.xsd", FileMode.Open), null));
The first add method works with no problem but the second one gives me an
error
"Restriction of anySimpleType is not allowed. An error occurred at
http://www.w3.org/2001/XMLSchema.xsd, (1447, 5)."
Thanks Tag: Wallpaper Tag: 70631
trying to get user properties from Active Directory
Hi all,
I have a good background in vbscript and know fairly well how to read
and write active directory with it.
I just passed now to vb.net and the gap is quiete impressive....
What I find most diffucult, however, is the declaration of the
variables. In vbscript these do not need to be declared or specified
the type.
Now, what I need to do is to bind a computer and read the
"userSharedFolderOther" attribute. I have a simple vbscript which does
the job but my vb.net cannot read this property.
I believe the problem might be in the variable not been declared
correctly.
I simply declared it as "Dim My var". I guess I should add something
like "as ...." but I don't know the type of variable...is it string
???? I can read other attributes fine, but not this one....
However, this is the code...(only the interesting part)...
Dim pcPrinter
Searcher.PropertiesToLoad.Add("userSharedFolderOther")
pcPrinter = (Computer.Properties("userSharedFolderOther").Item(0))
If IsArray(pcPrinter) Then
For Each Printer In pcPrinter
MsgBox(Printer)
Next
Else
MsgBox(Printer)
End If
Error: Specified argument was out of the range of valid values. vb.net
Says the guilty line is the one that starts with pcPrinter...
Can you help me out pls ?
Thanks in advance !!!!!
Bar Tag: Wallpaper Tag: 70623
Change <link> href attribute dynamically
Dear Friends
I want to change the name of my css file dynamically so
as Mr. Jos Branders helped me, I can change the <head> tag into an HTML
control like this:
<head id="myhead" runat="server">
...permanent content here...
</head>
so that I can modify it from code like this:
Sub Page_Load(sender As Object, e As EventArgs)
myhead.InnerHtml &="<LINK href=""Stylesone.css"" type=""text/css""
rel=""stylesheet"">"
End Sub
But when I run the code, I got this error:
The type or namespace name 'myhead' could not be found (are you missing a
using directive or an assembly reference?)
Please help.
Thanks in advance. Andy Tag: Wallpaper Tag: 70616
About GetMethod
Hi,everyone:
I have writen a DataGridEx inherited from DataGrid.I want to get the
DataGridRow[] of the DataGridEx's.
The code is following:
System.Reflection.MethodInfo Mi =
this.GetType().GetMethod("get_DataGridRows",
BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase |
BindingFlags.Instance |
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
System.Array dataGridRows= (System.Array)Mi.Invoke(this,null);
But nothing have get.
Is only DataGrid type can call "get_DataGridRows",the class inherited
from it can not ? If not ,how can I get the
DataGridEx's DataGridRow[]?
Thanks! Tag: Wallpaper Tag: 70613
Component dependencies, BeginInit() and Endinit()
Component A has a reference to Component B. Both implement
ISupportInitialize. In Component A's EndInit() routine, its initialization
has been finished so it triggers an even which Component B will handle. But
Component B's EndInit() has possibly not been called yet, and is therefore
not prepared to handle Component A's event. Is there a good solution to this
design problem in .NET ? Tag: Wallpaper Tag: 70612
StartPosition.CenterParent
Hi Guys and Gals,
I have a small, two form, application. Form1 is the main window and Form2 is
a small window that has a label and a progress bar on it. I wish to display
form2 whilst doing some processing in Form1 and update Form2 as the
processing is being completed. I have the update functionality working
properly, what I can't seem to get working is the functionality of being
able to position Form2 in the centre of Form1. I have set the StartPosition
property to CenterParent, but I can't seem to find a property where I can
set the parent property of Form2. Forms do have a Parent property,
unfortunately it's read only. I can get the form to behave, more or less,
correctly if I use ShowDialog instead of Show but that holds up processing
whilst the form waits to receive input it can pass back to the main form,
which of course is not ever going to come, as the form has no inputs of any
kind. The application is not an MDI application so I can't use the MDIParent
property.
I would also like to stop the form from being moved. Anyone know what
property or properties need to be set to make this happen? And I'd like to
turn off it's titlebar if possible.
Thanks
Regards
Greg Tag: Wallpaper Tag: 70605
Last Name First
I know I'm reinventing the wheel here, and not very elegantly. Can somebody show me a less embarrassing way of coding this
Dim s1 As String = "Dr. John Smith".Tri
Dim s2 As String = s
txtFirstString.Text = s
Dim i1 As Integer = s1.LastIndexOf(" "
s1 = s1.Substring(i1 + 1, s1.Length - i1 - 1
s1 = s1 & ",
s1 = s1 & s2.Substring(0, i1
txtSecondString.Text = s
txtSecondString.Text = Smith, Dr. Joh
thanks
polynomial5d Tag: Wallpaper Tag: 70602
C# Faster Than VB?
Is C# faster than VB .NET or are they only sepearted by a developers style and coding preference? I understand that all languages are compiled to MSIL so there should be no difference but you never know until you ask!
Cheers, Robby Tag: Wallpaper Tag: 70601
Compiling to different frameworks.
I have developed a VB .NET component using VS 2003 under version 1.1 of the framework. I want to produce two version of the component; one for each version of the framework. Is it possible to compile to different frameworks? When I create an exe the build page has an option for a target framework but it is disabled for components
Cheers, Robby Tag: Wallpaper Tag: 70599