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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile 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: 2.0 Recompile Tag: 113889
CodeDom AppDomain & AssemblyResolve event
I am using CodeDomProvider.CompileAssemblyFromSource to compile an assembly
in memory.
I would like to use the AppDomain AssemblyResolve event to help resolve
references added via CompilerParameters.ReferencedAssemblies - but the
compilation fails ("Metadata file ... could not be found") yet the
AssemblyResolve event is not raised. Tag: 2.0 Recompile Tag: 113887
Ngen process during installation of .net framework 1.1
Hi everyone,
I have observed that the ngen process appears in the list of processes
in
taskmgr while .net framework 1.1 gets installed. This process consumes
0-50%
of cpu and 0-20K of RAM.
I would like to know if this process can be a cause of slowing down
performance of a high speed application. The installer of this
application
examines whether .net framework is installed, if it is not installed it
first
installs .net 1.1 and then continues with its own installation.
It would be great if anyone knows about problems related to ngen during
installation of .net framework 1.1, say, under low memory conditions,
or for
particular OSs, or for particular hardware configuration
--
Thanks,
Sameeksha
MCAD.Net Tag: 2.0 Recompile Tag: 113882
Ngen process during installation of .net framework 1.1
Hi everyone,
I have observed that the ngen process appears in the list of processes in
taskmgr while .net framework 1.1 gets installed. This process consumes 0-50%
of cpu and 0-20K of RAM.
I would like to know if this process can be a cause of slowing down
performance of a high speed application. The installer of this application
examines whether .net framework is installed, if it is not installed it first
installs .net 1.1 and then continues with its own installation.
It would be great if anyone knows about problems related to ngen during
installation of .net framework 1.1, say, under low memory conditions, or for
particular OSs, or for particular hardware configuration
--
Thanks,
Sameeksha
MCAD.Net Tag: 2.0 Recompile Tag: 113881
How To Get Permission to Call File.SetAccessControl?
My program needs to update the access control rules for a file (actually a
virtual COMM port). I have the code working on my development machine. But when
run on a different machine (or same machine with another account), it fails
with a System.UnauthorizedAccessException. I presume it is because on my dev
machine/account my account is a member of the Administrators group and on the
other machine/account it is just a normal user.
But I need to have the code work for a non-admin user (basically any user).
What do I have to request to get this level of permission and how do I get it?
Thanks. Tag: 2.0 Recompile Tag: 113880
Trusting Assemblies Problem
Hi all,
I have an issue with trusting assemblies, I have a console app and which I
have transferred to a server and use a batch file to run the exe. I have
figured out that I need to trust the .exe for it to run on the server.
Problem is: any modification to the exe and copying the exe to the same
location does not run the program, it has to go through the process of
trusting again even if the change is minimal.
How can i avoid this?
Thanks,
Stephen Tag: 2.0 Recompile Tag: 113878
Need 1.1 and 2?
I am only using dotnet for apps that we installed that need it. This is a
dumb question but do we need both 1.1 and 2 or will just 2 do for our simple
need? Sorry to be so stupid about it but never can't find an answer on the
net. Thank you. Tag: 2.0 Recompile Tag: 113876
RegisterAssembly, CreateComInstanceFrom and IsCOMObject
I am registering a managed class as a COM class via
RegistrationServices.RegisterAssembly, then I am instantiating that class
via CreateObject, then I am testing if the object is a COM instance via
Type.IsCOMObject. Surprisingly (to me) the return value is False.
This is a problem for me, because I am using managed code to write a OWC
spreadsheet addin, and memory allocated by the addin is not freed when the
spreadsheet is destroyed. I wanted to explicitly invoke
InteropServices.Marshal.ReleaseComObject, but it is failing, presumably
because the object returned by CreateObject() is, in some way, not a COM
class.
Can anyone explain why the IsCOMObject is returning False, and what I might
be able to do to make it return True?
Sub Main()
Dim lvType As System.Type = GetType(ComClassTest)
Dim lvRegistrationServices As New
Runtime.InteropServices.RegistrationServices()
lvRegistrationServices.RegisterAssembly(lvType.Assembly,
Runtime.InteropServices.AssemblyRegistrationFlags.None)
Runtime.InteropServices.RegistrationConnectionType.SingleUse)
Try
Dim lvObject As System.Object =
Microsoft.VisualBasic.CreateObject(lvRegistrationServices.GetProgIdForType(lvType))
Debug.Assert(True = lvObject.GetType.IsCOMObject, "CreateObject
creates a COM object") ' this assertion fails
Finally
lvRegistrationServices.UnregisterAssembly(lvType.Assembly)
End Try
End Sub Tag: 2.0 Recompile Tag: 113874
"unable to write data to transport connection" error
Hi everybody.
Yes, I know there are a number of posts about this, but many of them
have not been answered and of those that have been, I can't find one
that exactly fits.
I am working in vb.net using a TCPClient object and sending commands to
a remote, IP-aware device. All goes swimmingly for a while, then I get
the above error.
The exception's "InnerException" is a "SocketError", with the message,
"An existing connection was forcibly closed by the remote host"
It's usually about 5 minutes or so before it gives up. The client who
owns the device says another version of our software connects fine all
the time, via a serial-to-ip conversion device/program. So it's
unlikely to be the device itself, despite the inner exception message.
I have tried both send and receive timeouts on the TCPClient - no
change.
I am at a loss - any ideas out there?
TIA,
Peter Royle Tag: 2.0 Recompile Tag: 113864
System.Configuration.Install.Installer and console
I have a Windows service exe that derives from
System.Configuration.Install.Installer
The exe can be executed from the command line with parameters such as
INSTALL, UNINSTALL, START, and STOP to perform such tasks on the service
But the exe is also the exe that _is_ the service process, so when it's run
with no parameters (by the SCM?) it calls
System.ServiceProcess.ServiceBase.Run ( srp.ServicesToRun ) ;
The problem then is when it's accidently run with no parameters from the
command line.
Is there some way for it to know whether or not it's being executed by the
SCM? I'd like it to be able to give a help message and terminate when it's
run from the command line while still behaving properly when running as a
service. Tag: 2.0 Recompile Tag: 113863
Copying a flash mem card, including boot sector.
Is there a .NET framework call that will make an exact copy of the contents
of a disk, including the boot sector if there is one?
What I have is a Windows CE device that boots from a compact flash card.
This device goes out to customers, where it runs a machine for them. I want
to make a utility that will allow them to back up and restore their system.
I know how to copy the files and directories from a disk, but that doesn't
result in a new, bootable, disk.
I could tell them to use Norton Ghost, and that would work just fine, but I
have already created a utility for managing the information on that disk.
It's a C# .Net framework 2.0 application. I would like to add a "make backup
disk" button to the menu of that utility, but I don't know how to copy the
boot information. Tag: 2.0 Recompile Tag: 113861
Using ManualResetEvent within a ContextBoundObject
For some reason, I tried to create an instance of the ManualResetEvent class
from the constructor of a class that derives from ContextBoundObject (for
automatic synchronization purposes), and after the call to "new
ManualResetEvent(false)" the watch window shows "undefied value" / null for
that instance, altough a call to Debug.Assert(event != null) doesn't assert!
Moreover, when I try to call Set on the event, an exception is thrown (can't
access a disposed object or something like that), even though I didn't
dispose of the event.
Is there a special problem regarding the use of ManualResetEvent in
ContextBoundObjects?
What is the reason for this?
Thanks. Tag: 2.0 Recompile Tag: 113858
Loading method on runtime
I am storing method names in one xml file , on run time i read method name
for ex class1.Method1 , I want invoke this method is there any facility in
system.reflection to load the methods like we load assemblies using
assembly.load. I would have instantiated the class before reading xml , Is
there any way I can load method on runtime.
Thanks in Advance
Sudheendra Tag: 2.0 Recompile Tag: 113855
INSERTing long TEXTs into MSSQL 8.00.2039
Hi,
I have a table with columns of types datetime, varchar, text, text, text,
text.
The text columns will contain XML documents, there is no primary key in the
table but they varchar column contains foreign keys.
If I insert trivial text values like "hello" everything works fine but when
I use real XML documents weird things start to happen. The row gets inserted
with no error message but when I view it in enterprise manager the particular
column that was supposed to contain the XML document is empty (the datetime
and all text columns with trivial values like "hello" or "world" is correctly
displayed).
After some experimentation I noticed that it appears to be the length of the
text field that determines whether that column will get a value or not. For
text values of length 900 chars and shorter it's no problem, but for text
values with a length of 901 chars that column will not be set but instead
empty. The actual content of the long text value does not matter, I tried to
insert a 900 char string of the letter "c" only and that worked, while 901
consecutive "c" chars causes the row to be inserted with a empty value where
the string of "c"s should have been.
My question is, how can I insert TEXT values longer than 900 chars? I know
this datatype should handle alot longer values...
FWIW; I'm using MSSQL 8.00.2039 and I'm doing the INSERTs using standard
.NET component (ver 1.1) such as SqlConnection and SqlCommand.
regards,
martin Tag: 2.0 Recompile Tag: 113850
callback supplied to Socket.BeginSend never gets called
Iâ??m having troubles with socket async operations using .NET 2.0. Sometimes a
callback supplied to Socket.BeginSend never gets called. I suspect this can
be caused by AVG Antivirus or MS AntiSpyware running on the PC, because if I
suppress them, everything goes fine.
Unfortunately, I was unable to reproduce the issue in isolated environment
as the problem has been reported by one of our customers who experiences it
in irregular way. Iâ??ve only managed to track it down to Socket.BeginSend and
the callback using our logging system.
Is it a known issue with Socket in .NET 2.0? Is there a fix to solve this
problem?
Thanks in advance! Any help would be highly appreciated. Tag: 2.0 Recompile Tag: 113846
Generic Lists Desing Issue
Generic Lists are great!
But I think you missed a opportunity.
Here is my problem.
I made a Collection "Family: List<Person> "
which will contain 'Family'. I wanted to override the Add method so you can
only add persons whose Parents or Childeren are already in the list, but the
Add method is not virtual!
The Add method of Arraylist is virtual and I see no reason for the generic
counterpart not to be.
My work around is to create my own GenericList that has a private List<T>
and duplicate all IList<T> members and make them virtual, but still it
should have been there all along.
I see no reason why List<> or all other generic collections have no virtual
methods, is there? Maybe speed, but that wasn't an issue with ArrayList so
it shouldn't be with generic collections either. Tag: 2.0 Recompile Tag: 113842
Threading problem in local COM server
We have defined a COM object in C# on the .Net platform (v2.0.50727) in
an out-of-process server (.exe). This COM object, in one of its
methods, creates a WebBrowser control (AxSHDocVw.AxWebBrowser). The
main application can successfully create an instance of this object,
but when trying to call the method creating the WebBrowser control, an
exception is thrown stating that
System.Windows.Forms: ActiveX control
'8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because
the current thread is not in a single-threaded apartment.
The Main() function in the COM server has the [STAThread] attribute
set, and we checked that this thread actually runs in a single thread
appartment. The constructor of the COM object is also called on this
thread, in STA. The method creating the web browser control, however,
is called on another thread, which indeed runs in MTA. We did not
create this thread, nor did (willingly) specify somewhere that a thread
should be created, and so we do not have control over the apartment of
that thread.
I don't know whether it is relevant, but the class factory of the COM
object is registered with the flags
CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE,
after which the Main() function goes on to accept COM requests by
calling
System.Windows.Forms.Application.Run ();
I'd be very grateful for any clues or hints.
Jeroen Tag: 2.0 Recompile Tag: 113833
Decimal/Single/...: which Numeric-type to use?
Hi,
I'm having some troubles with my numeric-types in my VB.NET 2005
application, together with a SQL Server 2000.
- I first used Single in my application, and Decimal in my database. But a
Single with value 4.475 was converted to a Decimal with value
4.4749999999999996D. So after inserting and selecting it from the database I
got another value than the original!
- So I used also the Decimal in my application, but now all my numbers are
formatted with all the decimals: when my value is "1", it shows "1.0000". A
single value roudns it nicely to 1, but the decimal value shows the whole
decimal part, even when it isn't needed.
What I need is: the users should only see the decimal part when needed, AND
my values have to be the same (no 4.475 to 4.474999999999 changements).
This seems such a simple and basic need, but I just keep having troubles
with it :-(
What should I do/use? Another numeric datatype in my application? Another
datatype in my Database??
Any help/hints/links/information would be really appreciated!
Thansk a lot in advance,
Pieter Tag: 2.0 Recompile Tag: 113832
WebRequest & proxy problem
In my auto-update code I donwload some files from the net with a WebRequest.
Some people having a proxy server reported problems.
IN a previous application I set the
WebRequest wr = ....;
wr.Proxy = WebProxy.GetDefaultProxy();
Which read proxy info from internet explorer. Great, exactly what I want.
But this method is now, in 2.0, apparemtly obsolete.
What could I use?
I read somewhere that someone suggested WebRequest.DefaultWebProxy, but
that's crazy, why set it if it's the default already?
I saw also the NetSectionGroup.DefaultProxy propery.
So now, what should I do?
Problem is I cannot test, we are not using proxy here .... :S and I don't
really know they work.... Tag: 2.0 Recompile Tag: 113826