Compiler Error
Why do I get an Identifier Expected Compiler Error in the following function
Function SubmitUpdate(ByVal row As DataRow, ByVal cmd As
OleDbCommand) As Integer
Dim pc As OleDbParameterCollection = cmd.Parameters
pc("CateroryID_Name").Value = row("CategoryID")
pc("CateroryName_New").Value = row("CategoryName")
pc("Description_New").Value = row("Description")
' THE FOLLOWING LINE CAUSES AN IDENTIFIER EXPECTED COMPILER ERROR
pc.("CategoryID_Orig").Value = row("CategoryID"),
DataRowVersion.Original)
pc.("CategoryName_Orig").Value = row("CategoryName",
DataRowVersion.Original)
pc.("Description_Orig").Value = row("Description",
DataRowVersion.Original)
Return cmd.ExecuteNonQuery
End Function Tag: Playing the video n audio files Tag: 114043
Renaming logical and physical files with SMO
Hi,
I have 2 database A and B on SQL Server 2005 Express. From both databases I
have a backup.
Now I want to use the backup B.bak to restore it to database A. The problem
is when i do so the logical filename and physical filenames of the .mdf and
.ldf of database A are overwritten with the filenames in the backupset i.e.
from database B.
How can I keep the logical and physical filename of database A when I
restore database A from a backup of database B using SMO.
When using SSMS you can modify the logical and physical filenames prior to
the execution of the restore. So the same should be possible using SMO, but I
don't know how.
Thanks Tag: Playing the video n audio files Tag: 114042
CLR 2.0 Sleep Call.
Hi,
Module written in 1.1 makes call to sleep.
The declaration in the module is:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Moved project to 2.0
Now I get an MDA Error:
PInvokeStackImbalance was detected
Message: A call to PInvoke function 'NameSpace.basGeneral::Sleep' has
unbalanced the stack. This is likely because the managed PInvoke signature
does not match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature.
Any suggestions on how to remedy this would be appreciated.
Thanks
Bob Tag: Playing the video n audio files Tag: 114039
Why use and what is project reference
Hello!
I use C# and VS 2003
My exe file is using several class dll
If I have a class Dll called Test.dll that I want to add a reference to I
use the add reference in project settings and select the.NET tab and then
brows to the directory and then
select the class dll called Test.dll.
Microsoft recommend that people should use project reference I just wonder
what does this mean actually and what advantage do I get. I just can't
understand what it means.
I mean that I must use that add reference and select the .NET tab and then
select the actual class dll otherwise I get error because it can't find the
class library.
//Tony
--------------------------------------------------------------------------------
begin 666 p.gif
M1TE&.#EAL0`-`( `````_____R'Y! ``````+ ````"Q``T```+MC(^IR^T/
MHYRTV@6ROD?OGB5 ,V)&R:5D>+;FVZFHZL8!.L\B4^HTC:OQA@@?Q<C1C91%
MVXTD_,EV2.>NF?(M3RRNENH(UC[/LJ?8/8."O2KVBF/UKD[R]M;URN<N\?KC
MYO=E-J; 1]C'YQ;55WB'YG'85F@UIA9)]S:TE0/8:"EG@UG&J,:(J&3$A.>I
MEV-820H[6\E)*J8HJONI*0O5E M,RUM'](9;:ZQJA8SH+$G9_- ,?1@%?<L\
M3,8Z+))W_!UJQGU9GH8V80=*>;W&#"XEGQ2Q.'^/GZ_O;8P?^0\PH,"!!.WM
(.X@PX;X"`#L`
`
end Tag: Playing the video n audio files Tag: 114022
NUnit says: An attempt was made to load a program with an incorrect format
I'm using NUnit to test my application but it is giving me odd error
messages that I have not seen before. I'm at a loss to think what
configuration change I have made that would break NUnit. (Or what
configuration changes I made at all) The application is new, so these
are new unit tests fixtures. I also upgraded to NUnit 2.2.7 in case
there was a problem with the previous version (no luck). My application
runs okay if I launch it, yet I cannot test it.
Here is the message produced by using the NUnit console through
TestDriven.NET:
------ Test started: Assembly: NOsm.Dao.Testing.dll ------
TestCase 'M:NOsm.Dao.Testing.BookmarkDaoTest.SimpleTest'
failed: Could not load file or assembly 'NOsm.Dao.Testing' or one of
its dependencies. An attempt was made to load a program with an
incorrect format.
System.BadImageFormatException: Could not load file or assembly
'NOsm.Dao.Testing' or one of its dependencies. An attempt was made to
load a program with an incorrect format.
File name: 'NOsm.Dao.Testing'
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener
testListener, ITraceListener traceListener, String assemblyPath, String
testPath)
at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind
failure logging.
To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
0 passed, 1 failed, 0 skipped, took 0.89 seconds.
The code for SimpleTest is:
[Test]
public void SimpleTest()
{
Assert.IsFalse(true);
}
If I use the NUnit GUI I get a slightly different exception:
System.IO.FileNotFoundException...
Server stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.AppDomain.Load(String assemblyString)
at NUnit.Core.Builders.TestAssemblyBuilder.Load(String assemblyName)
at NUnit.Core.Builders.TestAssemblyBuilder.Build()
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String testName)
at NUnit.Core.TestSuiteBuilder.Build(String assemblyName, String
testName)
at NUnit.Core.SimpleTestRunner.Load(String assemblyName, String
testName)
at NUnit.Core.SimpleTestRunner.Load(String assemblyName)
at NUnit.Core.ProxyTestRunner.Load(String assemblyName)
at NUnit.Core.ProxyTestRunner.Load(String assemblyName)
at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at NUnit.Core.TestRunner.Load(String assemblyName)
at NUnit.Util.TestDomain.Load(String assemblyFileName, String
testFixture)
at NUnit.Util.TestLoader.LoadTest(String testName)
Any help would be appreciated.
Thanks,
Colin. Tag: Playing the video n audio files Tag: 114017
Enum as a Generics constraint - why doesn't it work?
Hi Group.
I would like to do the following:
public static DecriptiveCollection GetValuesForDisplay<T>() where T :
System.Enum
{
DecriptiveCollection list = new DecriptiveCollection ();
foreach(T value in Enum.GetValues(typeof(T)))
{
// add description Attributes and enum values to collection
}
return list;
}
But I recieve an "Contstraint cannot be special class Enum" - compile error
...
- why is this?
Regards, Rune Tag: Playing the video n audio files Tag: 114016
Altrnative to Bitmap.GetPixel
Hi,
I was playing around the other day trying and I was programing a little
app that reads a image pixel by pixel and stores the color information
to a string, from which I can later generate the picture back...
The problem is that this is quite slow for larger images. So I was
wondering if there is any other library or something that would be
faster at this kind of operations. Tag: Playing the video n audio files Tag: 114015
Best design pattern for enabling/disabling menu items based on state of things?
For example, I have a TreeView user control on my main form. I want to
enable/disable various things on the MenuStrip and ContextMenuStrip based on
the state of things in the TreeView (basically, what kind of node is
selected). Looking for ideas on what the best design pattern is for this.
Quick and dirty is to pass references for the menu strips to the user
control and let it set enable/disable on the menu items as state changes,
but that feels like a hack. I guess the classic Observer pattern is called
for? I don't want to make this overly complex, I just want a more elegant
solution than tightly coupling the classes (reuse isn't an issue however). Tag: Playing the video n audio files Tag: 114005
how to fingerprint a user's machine?
hello-
i need to have a way to accurately 'fingerprint' an end-user's machine. the
resulting 'fingerprint' needs to be a simple string-based value. currently,
i have created the function listed below that i am using to do this.
however, this appears to break down from time to time and i cant determine
exactly why.
i know that enabling/disable network connections will change the produced
value, but is there something else that would change this? perhaps the type
of encryption i am using? should i use another one? when i run this function
lots of times, it produces the same fingerprint. however, it appears to
change later in the future, and i havent been able to detect why because it
doesnt change each time i call this function.
i am totally open to changing my approach entirely. like i said, i simply
need *some* way to accurately identify an end-user's machine
(programmatically, of course).
can someone please provide me with thoughts and an example that will
accomplish this task better?
many thanks!
ben
--------------------
using System;
using System.Management;
using System.Security.Cryptography;
namespace QC.Forensics.Hardware
{
public class LocalMachine
{
public static string MachineFingerprint
{
get
{
//get the collection of all of the network adapters on the local machine
ManagementClass pManagementClass = new
ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection pMOColl = pManagementClass.GetInstances();
//build our fingerprint, based on all the MAC addresses for each network
card installed on the local machine
string sFingerprint = "";
string sCurMACAddress = "";
foreach(ManagementObject pCurMO in pMOColl)
{
sCurMACAddress = "";
try
{
sCurMACAddress = pCurMO["MacAddress"].ToString();
}
catch { }
if (sCurMACAddress != "")
{
if (sFingerprint == "") sFingerprint = sCurMACAddress;
else sFingerprint = sFingerprint + ":" + sCurMACAddress;
}
}
//now hash our value to get our true fingerprint
byte[] aInBits = System.Text.ASCIIEncoding.ASCII.GetBytes(sFingerprint);
SHA1 pHasher = new SHA1CryptoServiceProvider();
byte[] aOutBits = pHasher.ComputeHash(aInBits);
sFingerprint = Convert.ToBase64String(aOutBits);
return sFingerprint;
}
}
}
} Tag: Playing the video n audio files Tag: 114004
Basic question about inheritance/hiding methods
I have a C# collection class that inherits from SortedList. I want to be
able to hide certain methods such as Add. How do I do that? Tag: Playing the video n audio files Tag: 114003
Implemented interface methods are not available and do not show in Intellisense?
I'm creating my own SortedList collection class that implements IDictionary,
ICollection, and IEnumerable. The code compiles.
I am writing a unit test to exercise it. I can create the object but none
of the methods like Add are available. The only thing that shows in
Intellisense is:
Equals
GetHashCode
GetType
ToString
What am I doing wrong?? Tag: Playing the video n audio files Tag: 114001
VSTS Performance Explorer issues
I'm trying to use the VSTS Profiler on a fairly large and complex .NET 2.0
application. In the past, I've always used the Compuware tools (especially
the Community Edition of their profiler) and am in general quite familure
with application tuning in .Net.
The application in question is a Windows Forms EXE with about 25 project
(all DLL's) under it, written using C# and a little of bit Managed C++. My
test environment is a Windows XP Professional machine and almost everything
is being built as "Any Cpu" (and what's not is being targeted at the x86
runtime).
When I create new performance session, I add in the "TestHarness" project -
this is the Winforms app that drives the DLL. In production this is a
Windows Service, but for testing I use the WinForms driver as it's alot
easier.
... so I create a performance session, add my TestHarness in, and try to hit
"Run". Unfortunatly the "run" button in the performance explorer is greyed
out. I've tried every means and mechanism I can think of, but it's always
greyed out. I've exited and come back in. I've switched between
Instrumentation and Sampling. I've kicked; I've screamed; I've yelled. I've
gone through the Wizard. I've done things manually. I offered up a prayer to
Bill and Steve. No dice.
I can run the application normally - I can set breakpoints, debug, etc. This
all works fine. It's just the Profiling infrastructure that seems to be
broken. If I create a little sample app, everything works fine. So I know
the installation of the profiling infrastructure is correct, and I know the
general process I'm using is valid.
I'm at my wits end in terms of getting this to work. I had really hoped this
would do the trick now that Compuware has stopped offering a free version of
their profiler - but so far I'm not not making much headway.
--
Chris Mullins Tag: Playing the video n audio files Tag: 113999
Question about generic IEnumerable
Visual Studio won't give me the "implement interface option" when I do this:
public class Dictionary<K,T> : IEnumerable<KeyValuePair<K,T>>
but it does when I do this:
public class Dictionary<K,T> : IEnumerable<K>
and what is the difference between the right-click menu choices "Implement
Interface" and "Implement Interface Explicitly"? They both appear to
generate the same code? Tag: Playing the video n audio files Tag: 113998
ANOTHER BIZTALK CONTRACT/ MA
OMNI
GROUP
tgugger@sbcglobal.net
419-537-9447
ANOTHER BIZTALK POSITION/ CONTRACT/ BOSTON AREA
We have another BIZTALK contract in the Boston area. This one is for
three months.
We need a developer who has this experience:
This is a mid to senior level Biztalk developer.
Need latest version of Biztalk.
Need knowledge of Rules Engineering
Need knowledge of Activity tracking.
If you are interested and QUALIFIED, please answer the seven questions
below. Email
answers WITH A RESUME to: tgugger@sbcglobal.net. Because resumes continue to
change
with each new contract, we do not store previously submitted resumes.
1.. BizTalk ------------------------yrs
2.. Latest Biztalk version --------
3.. Rules engineering exp ?
4.. Activity tracking exp ---------- ?
5.. Citizenship Status ------------
6.. Availability -------------------------
7.. Rate (1099 or c to c) -------------pr hr + expenses Tag: Playing the video n audio files Tag: 113991
Serious bug in .NET framework 2.0 - IShellLink interface crashes
This is a multi-part message in MIME format.
--------------080507040709070501060408
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
*Hello*
I wrote an application which runs perfect under .NET framework 1.1.
I was very disappointed, that a LOT of things do NOT work on *Framework
2.0*.
This framework is NOT downward compatible.
For one of the problems I could not yet find a solution or not even an
explanation:
My project loads a managed C++ DLL which uses the *IShellLink* interface
to resolve shortcuts.
The function ResolveShortCut() (see below) is called from the main C#
program in a thread loop to
resolve all links found on the desktop.
This works perfect on .NET framework 1.1
But on Framework 2.0 the behaviour is really strange and always different:
1.)
Sometimes the function ResolveShortCut() (see below) works 10 or even
100 times without problems.
2.)
Then suddenly it happens that *CoInitialize(0)* fails.
3.)
Another time *CoCreateInstance(CLSID_ShellLink, ...)* fails.
4.)
The next time at the point *i_ShLink->GetPath(...)* a crash appears
which cannot even be caught by a
try catch block (neither in managed C++ nor in the calling C# code !!)
_*Types of Crashes*_:
1.)
Sometimes the whole application crashes without any error message.
(the application silently disappears from the screen)
2.)
Another time I get a window which asks me to send the crash information
to Microsoft
3.)
Another time I get an error telling me something about "out of memory".
(which is nonsense)
___________________________________________________________________
_*Environment:*_
The problem appears on Windows 2000 and 2003.
I use Visual Studio 2003.
The *STRANGEST* thing is that this problem appears in the following cases:
1.)
The ONLY ever installed framework = 1.1 --> everything OK
2.)
framework 1.1 + 2.0 installed --> crashes *although* my application
loads the assemblies (mscoree.dll etc..) of framework 1.1 !!
3.)
framework 2.0 *UNINSTALLED* and only framework 1.1 installed --> crashes.
It is impossible to completely UNINSTALL framework 2.0 !
I saved the registry HKLM into a *.REG file, installed framework 2.0
then uninstalled it
and compared the registry with the saved file:
The result is shocking: *hundreds of entries in the Registry* and a
dozen of files are NOT removed !!
_*Conclusion:
*_If you ever installed framework 2.0 the computer is ruined.
It is impossible to completely remove framework 2.0.
My application still crashes even after framework 2.0 was uninstalled !!!!!
I have to install a fresh Windows to get it running again !!!!
I tried this on two different computers running Windows 2000 and 2003.
I can 100% reproduce this !
Additionally another function, which *CREATES *shortcuts also crashes
sometimes.
I did not yet test, which other functions using COM are also affected.
Is this a known problem ?
What can I do ?
Thanks in advance for any answer.
*Elmü*
____________________________________________________________________
Here is the code from my managed C++ DLL.
Please don't tell me that there is any bug in this code !
It runs PERFECTLY on framework 1.1 since years.
// this line may fail
hr = CoInitialize(0) called in the contructor.
hr = CoUninitialize(0) called in the destructor.
bool Utils::ResolveShortCut(String *ps_LNKfile, // IN: the link file
to resolve
String **pps_Path, // OUT: the target file
String **pps_CmdLine) // OUT: the command
line params (if any)
{
bool b_Ret = false;
IShellLink* i_ShLink;
IPersistFile* i_Persist;
WIN32_FIND_DATA k_Find;
WORD *u16_LNKfile =
(WORD*)Marshal::StringToHGlobalUni(ps_LNKfile).ToPointer();
// this line may fail
HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (void**)&i_ShLink);
if (SUCCEEDED(hr))
{
hr = i_ShLink->QueryInterface(IID_IPersistFile, (void**)&i_Persist);
if (SUCCEEDED(hr))
{
hr = i_Persist->Load(u16_LNKfile, STGM_READ);
if (SUCCEEDED(hr))
{
hr = i_ShLink->Resolve(0, SLR_NO_UI | SLR_NOSEARCH | SLR_NOTRACK |
SLR_NOUPDATE | SLR_NOLINKINFO);
if (SUCCEEDED(hr))
{
char s8_Buf[MAX_PATH];
s8_Buf[0] = 0;
// this line may completely crash the whole application! (but
only sometimes)
hr = i_ShLink->GetPath(s8_Buf, MAX_PATH, &k_Find, SLGP_SHORTPATH);
if (SUCCEEDED(hr))
{
b_Ret = true;
*pps_Path = new String(s8_Buf);
}
s8_Buf[0] = 0;
hr = i_ShLink->GetArguments(s8_Buf, MAX_PATH);
if (SUCCEEDED(hr))
{
*pps_CmdLine = new String(s8_Buf);
}
}
}
i_Persist->Release();
}
i_ShLink->Release();
}
Marshal::FreeHGlobal(u16_LNKfile);
return b_Ret;
}
--------------080507040709070501060408
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<b>Hello</b><br>
<br>
I wrote an application which runs perfect under .NET framework 1.1.<br>
<br>
I was very disappointed, that a LOT of things do NOT work on <font
color="#990000"><b>Framework 2.0</b></font>.<br>
This framework is NOT downward compatible.<br>
<br>
For one of the problems I could not yet find a solution or not even an
explanation:<br>
<br>
My project loads a managed C++ DLL which uses the <font color="#990000"><b>IShellLink</b></font>
interface to resolve shortcuts.<br>
The function ResolveShortCut() (see below) is called from the main C#
program in a thread loop to<br>
resolve all links found on the desktop.<br>
<br>
This works perfect on .NET framework 1.1<br>
<br>
But on Framework 2.0 the behaviour is really strange and always
different:<br>
<br>
1.)<br>
Sometimes the function ResolveShortCut() (see below) works 10 or even
100 times without problems.<br>
2.)<br>
Then suddenly it happens that <b>CoInitialize(0)</b> fails.<br>
3.)<br>
Another time <b>CoCreateInstance(CLSID_ShellLink, ...)</b> fails.<br>
4.)<br>
The next time at the point <b>i_ShLink->GetPath(...)</b> a crash
appears which cannot even be caught by a<br>
try catch block (neither in managed C++ nor in the calling C# code !!)<br>
<br>
<u><b>Types of Crashes</b></u>:<br>
1.)<br>
Sometimes the whole application crashes without any error message.<br>
(the application silently disappears from the screen)<br>
2.)<br>
Another time I get a window which asks me to send the crash information
to Microsoft<br>
3.)<br>
Another time I get an error telling me something about "out of memory".
(which is nonsense)<br>
<br>
___________________________________________________________________<br>
<br>
<big><u><b>Environment:</b></u></big><br>
<br>
The problem appears on Windows 2000 and 2003.<br>
I use Visual Studio 2003.<br>
<br>
The <b>STRANGEST</b> thing is that this problem appears in the
following cases:<br>
<br>
1.)<br>
The ONLY ever installed framework = 1.1 --> everything OK<br>
2.)<br>
framework 1.1 + 2.0 installed --> crashes <b>although</b> my
application<br>
loads the assemblies (mscoree.dll etc..) of framework 1.1 !!<br>
3.)<br>
framework 2.0 <b>UNINSTALLED</b> and only framework 1.1 installed
--> crashes.<br>
<br>
<br>
It is impossible to completely UNINSTALL framework 2.0 !<br>
I saved the registry HKLM into a *.REG file, installed framework 2.0
then uninstalled it<br>
and compared the registry with the saved file:<br>
The result is shocking: <b>hundreds of entries in the Registry</b> and
a dozen of files are NOT removed !!<br>
<br>
<br>
<u><b>Conclusion:<br>
<br>
</b></u>If you ever installed framework 2.0 the computer is ruined.<br>
It is impossible to completely remove framework 2.0.<br>
My application still crashes even after framework 2.0 was uninstalled
!!!!!<br>
I have to install a fresh Windows to get it running again !!!!<br>
<br>
I tried this on two different computers running Windows 2000 and 2003.<br>
I can 100% reproduce this !<br>
<br>
Additionally another function, which <b>CREATES </b>shortcuts also
crashes sometimes.<br>
I did not yet test, which other functions using COM are also affected.<br>
<br>
Is this a known problem ?<br>
What can I do ?<br>
<br>
Thanks in advance for any answer.<br>
<br>
<b>Elmü</b><br>
<br>
____________________________________________________________________<br>
<br>
Here is the code from my managed C++ DLL.<br>
<br>
Please don't tell me that there is any bug in this code !<br>
It runs PERFECTLY on framework 1.1 since years.<br>
<br>
<br>
<font color="#000066"><tt><font color="#ff0000">// this line may fail</font><br>
hr = CoInitialize(0) called in the contructor.<br>
<br>
hr = CoUninitialize(0) called in the destructor.<br>
</tt><br>
<br>
<tt>bool Utils::ResolveShortCut(String *ps_LNKfile, // IN: the link
file to resolve<br>
String **pps_Path, // OUT: the target
file<br>
String **pps_CmdLine) // OUT: the command
line params (if any)<br>
{<br>
bool b_Ret = false;<br>
IShellLink* i_ShLink;<br>
IPersistFile* i_Persist;<br>
WIN32_FIND_DATA k_Find;<br>
<br>
WORD *u16_LNKfile =
(WORD*)Marshal::StringToHGlobalUni(ps_LNKfile).ToPointer();<br>
<br>
<font color="#ff0000"> // this line may fail</font><br>
HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER,<br>
IID_IShellLink, (void**)&i_ShLink);<br>
if (SUCCEEDED(hr))<br>
{<br>
hr = i_ShLink->QueryInterface(IID_IPersistFile,
(void**)&i_Persist);<br>
if (SUCCEEDED(hr))<br>
{<br>
hr = i_Persist->Load(u16_LNKfile, STGM_READ);<br>
if (SUCCEEDED(hr))<br>
{<br>
hr = i_ShLink->Resolve(0, SLR_NO_UI | SLR_NOSEARCH |
SLR_NOTRACK |<br>
SLR_NOUPDATE | SLR_NOLINKINFO);<br>
if (SUCCEEDED(hr))<br>
{<br>
char s8_Buf[MAX_PATH];<br>
s8_Buf[0] = 0;<br>
<br>
<font color="#ff0000"> // this line may completely crash the
whole application! (but only sometimes)</font><br>
hr = i_ShLink->GetPath(s8_Buf, MAX_PATH, &k_Find,
SLGP_SHORTPATH);<br>
if (SUCCEEDED(hr))<br>
{<br>
b_Ret = true;<br>
*pps_Path = new String(s8_Buf);<br>
}<br>
<br>
s8_Buf[0] = 0;<br>
hr = i_ShLink->GetArguments(s8_Buf, MAX_PATH);<br>
if (SUCCEEDED(hr))<br>
{<br>
*pps_CmdLine = new String(s8_Buf);<br>
}<br>
}<br>
}<br>
i_Persist->Release();<br>
}<br>
i_ShLink->Release();<br>
}<br>
Marshal::FreeHGlobal(u16_LNKfile);<br>
return b_Ret;<br>
}<br>
<br>
</tt></font><br>
</body>
</html>
--------------080507040709070501060408-- Tag: Playing the video n audio files Tag: 113983
migration from asp: better client or server-side code?
Hi,
I made an application in classic asp (reservation of books and video stuffs
for students) and want to migrate to asp.net.
The user has to chose a date, then pushung on a submit button. The whole day
is then displayed in cels of a table. The user has then to click in a cel
representing a hour of the day and an object (book ..), and finally click on
the submit button to insert that reservation in the database.
My problem is: there is a lot of javascript client-side code. All onclick
events are executed on client-side.
Have i to change this into server-side code or i can still use that
client-side code?
Is it true that the filosophy of asp.net is: maximum server-side script and
minimum client-side? If so, is there no danger to overload the server,
instead of sharing the execution of the application between client and
server?
Thanks for help
Ben Tag: Playing the video n audio files Tag: 113982
.Net 2 backgrounder
I am looking for pointers on creating a .Net 2.0 Win app that can change
the wallpaper of a windows machine. Namely, how to change the wallpaper.
Thanks. Tag: Playing the video n audio files Tag: 113980
Dynamic Method's Body and IL ???
Hi
I am using C# 2.0. I need to use the MethodBuilder.CreateMethodBody
that takes byte[] as the input parameter taking the IL codes as byte
array. I feed this input from MethodBody.GetILAsByteArray. But when the
method created dynamically via MethodBuilder.CreateMethodBody is
invoked by TypeBuilder.Invoke, it throws exception [inner exception]
"Bad Method Token". If the body of the method [which is requested as
IL by the MethodBody.GetILAsByteArray] is empty, then the method
executes successfully.
Is there any special that has to be done with the byte [] from
MethodBody.GetILAsByteArray before giving it as input to the
MethodBuilder.CreateBody.
I could not find enough information even on the MSDN documentation
about this.
Your help is appreciated.
Thanks
Vivek Ragunathan Tag: Playing the video n audio files Tag: 113978
RemoveDirecoty
Is there an example of the use of the 2.0 FTP RemoveDirectory ... anywhere?
--
-- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
-- Tag: Playing the video n audio files Tag: 113974
Error adding to the OleDbParameterCollection object
Thanks for any thoughts on this
I receive the following error when I run the code snippet below:
An OleDbParameter with ParameterName 'CateroryID_New' is not contained by
this OleDbParameterCollection.
Private Function CreateUpdateCommand() As System.Data.OleDb.OleDbCommand
Dim StrSQL As String
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Ole DB Services=-4; Data Source=C:\Program File"& _
"s\Microsoft.NET\SDK\v2.0\QuickStart\aspnet\samples\data\App_Data\Northwind.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString)
strSQL = "UPDATE [Categories] SET CategoryName=?, Description=?
WHERE CategoryID=?"
Dim cmd As New System.Data.OleDb.OleDbCommand (strSQL, dbConnection)
Dim pc As System.Data.OleDb.OleDbParameterCollection = cmd.Parameters
pc.Add("CategoryID_New", System.Data.OleDb.OleDbType.Integer)
pc.Add("CategoryName_New", System.Data.OleDb.OleDbType.BSTR)
pc.Add("Description_New", System.Data.OleDb.OleDbType.BSTR)
pc.Add("CategoryID_Orig", System.Data.OleDb.OleDbType.Integer)
pc.Add("CategoryName_Orig", System.Data.OleDb.OleDbType.BSTR)
pc.Add("Description_Orig", System.Data.OleDb.OleDbType.BSTR)
Return cmd
End Function Tag: Playing the video n audio files Tag: 113968
Update function created using Web Matrix Code Wizard fails
Hello,
I am using the Web Matrix Code Wizard's Update feature. I have a very
simple user interface that has two textboxes. One is for a Name and the
other is for a Description. I also have a dropdown listbox. I am working
with the Northwind database attempting to update the Category table.
The dropdown listbox is populated with the categoryID and the two textboxes
are for the CategoryName and CategoryDescription fields. I have data
successfully populating the textboxes and when I select a new categoryID in
the dropdown listbox, the data in the textboxes changes accordingly.
My problem is updating the database. Below I have a function that was
created using the Update Code Wizard. I also have an event subroutine that
fires when I click the Save button which calls the MyUpdateMethod function.
Not sure why, but when I make changes to the textboxes and click save, the
changes do not stick. I select a different ID and then select the ID that I
made changes to but the changes are not there.
I am running on my localhost Web Matrix Server.
To view a MSDN walkthrough of a similar exercise go to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbwlkwalkthroughupdatingdatausingdatabaseupdatequeryinwebforms.asp
Any ideas would be greatly appreciated.
Function MyUpdateMethod(ByVal categoryID As Integer, ByVal categoryName As
String, ByVal description As String) As Integer
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Ole DB Services=-4; Data Source=C:\Northwind.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString)
Dim queryString As String = "UPDATE [Categories] SET
[CategoryID]=@CategoryID, [CategoryName]=@CategoryName,
[Description]=@Description WHERE ([Categories].[CategoryID] = @CategoryID)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dbParam_categoryID As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_categoryID.ParameterName = "@CategoryID"
dbParam_categoryID.Value = categoryID
dbParam_categoryID.DbType = System.Data.DbType.Int32
dbCommand.Parameters.Add(dbParam_categoryID)
Dim dbParam_categoryName As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_categoryName.ParameterName = "@CategoryName"
dbParam_categoryName.Value = categoryName
dbParam_categoryName.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_categoryName)
Dim dbParam_description As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_description.ParameterName = "@Description"
dbParam_description.Value = description
dbParam_description.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_description)
Dim rowsAffected As Integer = 0
dbConnection.Open
Try
rowsAffected = dbCommand.ExecuteNonQuery
Finally
dbConnection.Close
End Try
Return rowsAffected
End Function
' ddlCategoryID is the dropdown listbox ID, txtCategoryName and
txtCategoryDescription are textbox ID's
Sub btnSave_Click(sender As Object, e As EventArgs)
MyUpdateMethod(ddlCategoryID.SelectedIndex,
txtCategoryName.Text, txtCategoryDescription.Text)
End Sub Tag: Playing the video n audio files Tag: 113967
2.0 Recompile
I am posting code into the app_Code directory, which doesn't seem to force a
recompile. How can I force a recompile?
--
Arne Garvander
Certified Geek Tag: Playing the video n audio files Tag: 113966
DataViewRowState returning bogus value ??
In an attempt to update an Access database, I have DataViewRowState returning
a value of 28 which is not in the properies list of values.
Here is a code snippet:
Dim cmdUpdate As System.Data.OleDb.OleDbCommand =
CreateUpdateCommand()
Dim row As System.Data.DataRow
Dim intRowsAffected As Integer
Dim dvrs As System.Data.DataViewRowState
dvrs = System.Data.DataViewRowState.ModifiedCurrent Or
System.Data.DataViewRowState.Deleted Or System.Data.DataViewRowState.Added
msgbox(dvrs)
For Each row In tbl.Select ("", "", dvrs)
msgbox("in the for loop")
I never make it inside the For loop... Tag: Playing the video n audio files Tag: 113965
Uploading Files
I'm trying to figure out a way for a user to be able to select a file name
(on their local hard drive) and upload it to a web server. That's the easy
part...and I use a standard Input tag with a type=file. What I would like
to do is also upload a couple of other files automatically.
For example, the users choose c:\myfile.txt. I would also want to upload
c:\myfile.gif and c:\myfile.jpg.
I would assume this is impossible to do, for security reasons....unless I
wrote and activex component to do it...? Tag: Playing the video n audio files Tag: 113963
Updating access database
Thanks in advance for any help.
I am using code that is directly from David Sceppa's book from MS Press
titled "ADO.NET".
I have walked completely though the code and I find values are what they
should be until I reach the following subroutine.
Private Sub SubmitChangesByHand()
Dim cmdUpdate As System.Data.OleDb.OleDbCommand =
CreateUpdateCommand()
Dim row As System.Data.DataRow
Dim intRowsAffected As Integer
Dim dvrs As System.Data.DataViewRowState
dvrs = System.Data.DataViewRowState.ModifiedCurrent Or
System.Data.DataViewRowState.Deleted Or System.Data.DataViewRowState.Added
For Each row In tbl.Select ("", "", dvrs)
msgbox("in the for loop")
intRowsAffected = SubmitUpdate(row, cmdUpdate)
msgbox(intRowsAffected)
if intRowsAffected = 1 then
row.AcceptChanges()
else
row.RowError = "Update attempt failed"
End If
Next row
End Sub
For some reason I am not getting inside the For loop. Only thing I can see
is that the DataViewRowState is returning a value of 28 which should be 16
(for updating a database). I invoke the function by a button click event
elsewhere in the code.
Other than that, the table has records in it which is declared elsewhere as:
Dim tbl As New System.Data.DataTable("categories")
I am using the Northwind database in my trial efforts. Tag: Playing the video n audio files Tag: 113962
Help with dsoFramer
Has anyone had a chance to get the dsoFramer sample code from MSFT to work
in DOT.NET VB? If so, could you please share your code with me. I just
need to open an OFFICE document and view it; nothing else.
TIA
John Tag: Playing the video n audio files Tag: 113960
Assembly Version
In the 1.1 framework the assemly Version would optionally auto-increment.
In the 2.0 framework the auto increment seems to be only available on
one-touch deployment.
How can I put auto-increment back on a non-one-touch assembly?
(I am written a windows service)
--
Arne Garvander
Certified Geek Tag: Playing the video n audio files Tag: 113954
Slow loading of file icons
Hello
I've got a problem with loading file icons to TreeView. I'm diplaying
only some directories in TreeView (~50 files total), but it's taking a
long time to add them.
Loading is done by [DllImport("Shell32.dll")]...SHGetFileInfo(...) and
it's fast enough, but then doing ImageList.Add(...) is taking up to a
couple of seconds for ~20 icons, which is really bad. Is there any way
to help it? (no delayed loading on expand event and this kind of stuff,
please - it's only about adding (string, Icon) to ImageList).
Writing in c#... Tag: Playing the video n audio files Tag: 113952
CounterSample & nextSample
I need to produce the 5 minute average CPU utilization for a system (the
average utilization over a 5 minute period). I found the below article that
seems to do a reasonably complete job of explaining the differences between
raw, calculated and sampled performance data.
http://msdn2.microsoft.com/en-us/library/xb29hack.aspx
CPU utilization is of type Timer100NsInverse. So here is my question: to
get the most accurate 5 minute average of CPU utilization, should I be
taking a sample at 0 minutes, another sample at 5 minutes, and then
calculate the results (see below code for an example)?
Advice would be appreciated. Thanks in advance.
Joe
// 1st sample
counter = new PerformanceCounter("Processor", "% Processor Time", "_Total",
"192.168.130.9");
sample1 = counter.NextSample();
counter.Close();
Thread.Sleep(5*60*1000);
// 2nd sample
counter = new PerformanceCounter("Processor", "% Processor Time", "_Total",
"192.168.130.9");
sample2 = counter.NextSample();
counter.Close();
// Output results
Console.WriteLine("CPU util = " + CounterSample.Calculate(sample1,
sample2)); Tag: Playing the video n audio files Tag: 113949
My Project/Settings.settings
Hi
In a Windows project you have a folder called 'My Project' with a
Settings.settings file. However you don't have the same option for a Web
project...how come? and how do you do something similar for a web project???
TIA
Søren Tag: Playing the video n audio files Tag: 113947
Equivalent to VCL's DataModule
In Borland's VCL ( Visual Component Library ), one can use a DataModule
into which one can drop non-visual components from the RAD designer. The
DataModule is a design-time visual container for non-GUI components,
which is never seen visually at run-time as a GUI control. An
application or Dll can have any number of datamodules in it, each with
its own name. One can also manually add any non-GUI data to any
particular DataModule. For an application at run-time, datamodule
instances for each visual datamodule are automatically created just like
forms, while for a Dll at run-time it is the programmer's responsibility
to create datamodule instances for each visual datamodule created at
design time.
I have found the ability to use datamodules as visual containers to
non-GUI components in an application or Dll to be very useful.
Admittedly a datamodule is nothing more than a class which contains
instances of non-GUI components and possibly other non-GUI fields, but I
like the ability to manipulate it at design time, and as a means of
separating the data portion of an application or Dll from the GUI portion.
Does .NET have any equivalent to this idea, so that non-visual
components can be created at design time without having to drop such a
component on a Windows or Web form. ? Tag: Playing the video n audio files Tag: 113946
UTF8 to UTF16 ?
I'm somewhat confused about Unicode but up until now I havent really seen
much issues with using it up until recently. We recently started using an
SMS gateway that requires a unicode message to be sent as a hexadecimal
string where each byte code has been replaced with their hexadecimal value,
for example: 043104AF0442044D044...
This string according to their documentation must be in UTF-16 before
conversion to the hexadecimal form, we however are using UTF-8 on our
website and all the texts are entered as UTF-8.
When I try to send a unicode formatted message using content from our
website it shows some characters correctly but not all of them, I cannot see
another reason for this than the fact that we are using UTF-8 and they
require it to be in UTF-16.
Now to the questions:
1. How do I convert between UTF-8 and UTF-16 ? I was looking at the Decoder,
Encoder classes but it doesn't really provide a direct way to convert
between encodings that I could see.
2. Since all strings are actually UTF-16 in .NET does this mean that the
conversion already has been made or does it mean it is actually storing
UTF-8 encoded bytes into a UTF-16 string ?
Thank you
PL. Tag: Playing the video n audio files Tag: 113945
Additional component to web service
I post here is because there is no one answer my question(10 days ago) in
"web service" news group.
I am going to implement a program on the web service side. The program will
work with the web services so that it can do some check on the data before
invoking any web method. The program will do some general checks, and does
not know exactly what kinds of web methods behind.
I think I could write a dll, then let the web services to call this dll
first before the web methods are invoked. But I do not how to do exactly.
Is there any way to integrate the program into the web services? Please
give me a guide in details.
Thanks. Tag: Playing the video n audio files Tag: 113944
help: simple csc works in 1.1 but not 2.0 framework
I'm pulling my hair out! Is this a bug??
Scenario - boiled down as simple as I can make it.
1. Created 2.0 console app.
2. Added reference: (COM tab) "Microsoft CDO for Windows 2000
Library"
---- This adds CDO and ADODB references to the project
3. Added a few lines of code (see below)
4. Compiles just fine from VS 2005. (puts Interop.CDO.dll and
interop.ADODB.dll in debug dir.
5. If I copy the code and the Interop.CDO.dll and interop.ADODB.dll to
a single directory and run csc on it, framework 1.1 csc compiles fine,
2.0 csc gives errors acting like the ref is not there.
Code ------------------------
using CDO;
using ADODB;
public class XXXX
{
static void Main()
{
CDO.Message cdoMessage = new CDO.MessageClass();
CDO.Configuration configuration = new CDO.ConfigurationClass();
configuration = cdoMessage.Configuration;
ADODB.Fields fields = configuration.Fields;
}
}
ERROR from CSC -------------------------
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
Mailer.cs(23,7): error CS0012: The type 'ADODB.Fields' is defined in an
assembly
that is not referenced. You must add a reference to assembly
'ADODB,
Version=7.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'.
Interop.CDO.dll: (Location of symbol related to previous error)
Mailer.cs(23,29): error CS0266: Cannot implicitly convert type
'ADODB.Fields []'
to 'ADODB.Fields [z:\test\Interop.ADODB.dll]'. An explicit
conversion
exists (are you missing a cast?)
--------------------------------
Any kind sole have an idea on what the issue is or how I can fix
it?????????????????
All advice appreciated. Thanks. Tag: Playing the video n audio files Tag: 113937
Help with event response in threadpool.
I am using a controls, webbrowser, in threadpool. every thread
has its own webbrowser object. at the same time, i must response for
the event DocumentComplete, i don't know whether the event should be
fired when the thread method returned?
How to realize this? Tag: Playing the video n audio files Tag: 113934
how to interpret Number property in System.Data.SqlClient.SqlError
Environment: .NET 1.1, SQL 2000, VS.NET 2003.
We have some logic in an application to perform some recovery operation
on the client side based on the SQL error code returned from
System.Data.SqlClient.SqlError. It seems to me that the Number
property in System.Data.SqlClient.SqlError is a perfect fit.
According to the manual page, The Number property in
System.Data.SqlClient.SqlError corresponds to an entry in the
master.dbo.sysmessages table. I managed to get some numbers not listed
in the master.dbo.sysmessages table: 11 (General network error. Check
your network documentation), and 17 (SQL Server does not exist or
access denied). It is reasonable that these network related errors do
not appear in the master.dbo.sysmessages table. However, I was
wondering, in addition to 11 and 17, what are other possible error code
(returned by Number property in System.Data.SqlClient.SqlError) not
listed in master.dbo.sysmessages table???
I remember that ODBC (in unmanaged C/C++ code) has very detailed
description for EACH error code and sql state, and people always
suggest that we use System.Data.SqlClient instead of System.Data.Odbc.
I already tried MSDN as well as google various places without luck.
Or is there any other way to do what I wish to do?
Any hints/suggestions are appreciated.
Thanks.
Kong Tag: Playing the video n audio files Tag: 113929
Remoting a collection class?
I want to create a collection class (List or SortedList, etc) that is
remotable (inherits MarshalByRefObject). Because C# doesn't support
multiple class inheritance I can't just do this:
public class Groups : List, MarshalByRefObject
I know I can implement all of the collection interfaces myself but what a
hassle. Is there a simpler way? Tag: Playing the video n audio files Tag: 113926
Question Framework 1.1 & 2.0
If I have installed both versions of the framework, can I say to may
application use 1.1 or 2.0 or when I run the applicacion will use the higher
version???? Tag: Playing the video n audio files Tag: 113920
HttpWebRequest / CookieContainer - not deleting cookies.
when I use HttpWebRequest with CookieContainer object that handles cookies,
if I have this cookie header in a response:
Set-Cookie: CookieName=; path=/;expires=01-Jan-1999 00:00:00 GMT
the cookie is not deleted for the next request, what should be and actually
done with Internet Explorer as client.
is this a bug is there a solution / workaroung by manually deleting the
cookie?
TIA. Tag: Playing the video n audio files Tag: 113919
errors 1.1
System.Windows.Forms.Control
1. virtual fuctions OnPaint, OnCreated are breaking, but System.EventHandler
is good
.
2.SetStyle(System.Windows.Forms.ControlStyles.Opaque,false);
is breaking (I try it in inner constructor class from inherit)
but bellow is good:
System.Drawing.Bitmap bitmap=new
System.Drawing.Bitmap(control.Width,control.Height);
bitmap.MakeTransparent(control.BackColor);
control.BackgroundImage=bitmap; Tag: Playing the video n audio files Tag: 113915
.NET 2.0 application stop serving ASPX pages?
I've set up a development ASP.NET 2.0 application folder on a
development server.
This folder has been set up since at least January, and I have been
working in it myself since February 2nd. It has been working fine up
until this week.
Three times this week it has locked up and no longer serves up .NET
page requests. You can still access the files there through Windows
explorer, and it still will serve non-.NET files such as ASP pages or
text files through the browser, but it will not serve up any .NET ASPX
pages.
Even if the code inside is recompiled, or new pages are added, they are
still not served up.
I have eliminated any code-related issues on this, and have confirmed
that if I restart IIS, then it starts working again. This did not
happen for the past six weeks at least, but this week it has happened
three times in four days.
The lock-up today happened when I made a change to a web.config file
but did not re-compile or anything, and when I hit the site again, it
was doing this. I have made other web.config changes this week that did
not cause this problem.
Anyone else having this problem or know what is causing this? Tag: Playing the video n audio files Tag: 113910
Printing Anomily
Hi,
I have a problem that I recently solved and thought I would throw it out to
see if anyone can explain why I had to use the particular solution.
I have an application that prints a series of numbers to any printer. It
was developed in C# for .NET 2.0 Framework. The code looked like this
//variable to hold the last Page and Print settings
private PageSettings lastPageSettings;
public FormMain()
{
InitializeComponent();
lastPageSettings = new PageSettings();
}
private void runToolStripMenuItem_Click(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
FormNumberer thisForm = (FormNumberer)this.ActiveMdiChild;
pd.PrintPage += new PrintPageEventHandler(thisForm.RunPage);
pd.DefaultPageSettings = lastPageSettings;
printDialog.Document = pd;
if (printDialog.ShowDialog() == DialogResult.OK)
pd.Print();
}
Here is the issue. The above code works fine on a Wndows XP Machine. When
the application is copied to a Windows 2000 Machine and executed I get a
memory error at the line pd.Print(). Now while debugging I observed that
the PrintDialog placed the printer settings into pd.PrinterSettings, but not
into pd.DefaultPageSettings.PrinterSettings. So therefore the two variables
would contain different printers if the default printer was not used.
So I made this adjustment:
if (printDialog.ShowDialog() == DialogResult.OK)
{
pd.DefaultPageSettings.PrinterSettings =
printDialog.PrinterSettings;
pd.Print();
}
And now everything works fine.
Does anyone have a clue as to why this may be?
Thanks,
Bryan Tag: Playing the video n audio files Tag: 113905
.Net framework 2.0 and IIS
Dear all
If I install the .Net framework in my IIS server? Are there any impact wil
be affected to the current ASP application? Will it update the files for the
current ASP component?
regards
Good Tag: Playing the video n audio files Tag: 113903
(paritially) trusted caller exception problem
Hi,
I have created an simple example to show of my problem and hope that someone
could help me.
SecurityTest (Solution)
|
+---SecTest (Project, Console Application)
+---SecurityLib (Project, Library)
+---SecurityLib2(Project, Library)
SecTest (Referenz auf SecurityLib) macht nichts anderes als
using System;
using System.Collections.Generic;
using System.Text;
using SecurityLib;
namespace SecTest
{
class Program
{
static void Main(string[] args)
{
Test x = new Test();
x.run();
}
}
}
the following lines are added to the AssemblyInfo.cs of SecurityLib and
SecurityLib2
//Remove all Permissions from Assembly to Explizit set them with
RequestMinimum
[assembly:
System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.RequestOptional,
Unrestricted = false)]
if I comment out the lines all is working fine, but i want to explizit allow
permissions with RequestMinimum
SecuityLib (reference to SecurityLib2) is implemented as
using System;
using System.Collections.Generic;
using System.Text;
using SecurityLib2;
namespace SecurityLib
{
public class Test
{
private class InternalClass : Class1
{
int _x;
public InternalClass(int x) : base()
{
_x = x;
}
}
public void run()
{
int y = 0;
y = 11;
InternalClass ic = new InternalClass(y);
//<-----------------------Exception occurs
}
}
}
SecurityLib2 looks like
using System;
using System.Collections.Generic;
using System.Text;
namespace SecurityLib2
{
public abstract class Class1
{
}
}
It's working if I AllowPartitialTrustedCallers in SecurityLib2, but I do not
want that for all classes.
The question is what's the permission to set (to RequestMinimum) so that the
code is working.
On my reallifeproject in the additional line in the AssemblyInfo.cs are
[assembly:
System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.RequestOptional,
Unrestricted = false)]
[assembly:
System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.RequestMinimum,
SerializationFormatter = true)]
[assembly:
System.Net.SocketPermission(System.Security.Permissions.SecurityAction.RequestMinimum,
Unrestricted = true)]
but that has no impact on the problem itself.
Hope someone could help
Thanks
Mike Tag: Playing the video n audio files Tag: 113895
Help! OnClick event in VScrollBar in .Net Compact Framework
Hi!
I tried to catch the Click event from a VScrollBar control but the Click
event is not rised. MSDN says that OnClick event is suported by .Net Compact
Framework and, in this case, I supose that the click event sould be rised bu
VScrollBar.
In this case I derived a class from VScrollBar and I overrided the OnClick
protected method. I failed again because the overrided OnClick method is
never called.
I derived another class from Control and I overrided again the OnClick
method. In this case the overrided OnClick method was called.
Please, there is anybody who can tell me what is happening with OnClick
method and Click event for VScrollBar control? And what should I do to catch
the Click event for VScrollBar? Or what should I do to make it work OnClick
overrided method in a derived class from VScrollBar?
I use Windows XP Professional, Visual C# fromVisual Studio 2005 Professional
Edition, .Net Compact Framework 1.0 or 1.1
Thank you in advance!
Best regards,
Cornel Gligan Tag: Playing the video n audio files Tag: 113894
Creating simple exe that runs without framework?
Hi all,
probably a simple question for most of you:
Can I create a simple executable with vb.net, that can run without the
.Net framework installed? (like any executable created with VB6 in the
old days..) I would like to stay away from permissions, strong naming
GAC etc. for some simple tools...
Thx,
Marcel
P.S. Why is it that .Net ships with command line tools that could
easily be implemented with an interface???? (sn, gacutil, caspol..) Tag: Playing the video n audio files Tag: 113891
clr error : 800700b
My machine: Windows XP sp2
Hi, I have Vs.net 2003 with .net 1.1 sp 1
I installed also vs.net 2005
Each tool from 2003 sdk shipped with vsnet: TlbImp, ResGen etc
gave first an error:"Unable to find a version of runtime to run this
application"
After I created a config file where I specified the runtime version 1.1.XXX
I get this error: "clr error : 800700b" which seems to be BadImageFormat for
an assembly.
In most machines in our company we have the same problem and we are not able
to find the cause for this errors.
Does anyone have a clue or a tip for tracking the error cause? Tag: Playing the video n audio files Tag: 113889
A> Hi,
A> I want to play audio n video files in my web application...
A> How can I do this?
A> Are there any samples..
A>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche