Stars seem to be stumped
I'm getting a reproducible error from when I installed the .Net
Framework 1.1 upgrade and when I try to run a pgm that I think uses it.
The error is:
Fatal execution engine error 0x7926e693
I am running WinXP Pro SP1 on a P4.
What's up?
Thanks
ps. I re posted as I got no answer the first time. Tag: FWD: Take a look at the package Tag: 58200
applications supporting both CRT and LCD
Hi
I have a Windows Applications written in C#. End users of the application
may have either CRT or LCD monitors.
I would like to display some very light shades of colour. However the
colours look different on a LCD & a CRT monitor. Light colours look darker
on a CRT monitor & very light colours hardly even show on a LCD monitor.
Is there anyway to determine what type of Monitor a computer is running?
That way I could alter the colours depending on the monitor type - and
ultimately have my application look very similar regardless of monitor type.
Thanks
Clare Tag: FWD: Take a look at the package Tag: 58195
Windows service and MMC?
Hello.
I wrote simple Windows service. I'm wondering now, how
can I manage this service with my custom Management
console snap-in.
Is there any documentation how to write MMC snap-in in C#
and .NET. I found lots of code in C++, but nothing in C#.
On the other hand, I can write an application that
doesn't make use of MMC [only simple windows-form with
tree-view control]. Is this better approach?
Thank you for any given answer.
Marek Tag: FWD: Take a look at the package Tag: 58190
SSI in IIS 5.1
I have a .shtml file with include statement like:
<!--#include virtual="../includes/header.inc" -->
The included content is displayed when this statement is
in an aspx file but not when it is in a shtml file.
I have configured the application mapping in IIS
for .shtml files to use aspnet_isapi.dll limited to
GET,HEAD,POST,DEBUG like what is currently set for aspx
files.
Does someone have an idea where I am going wrong? Thanks. Tag: FWD: Take a look at the package Tag: 58183
Don't understand compile error msg (abstract classes, interfaces)
I defined the following interface
using System;
using System.Drawing;
public interface IVisibleCell
{
System.Drawing.Image GetImage();
}
but I got the compile error
"Cannot create an instance of the abstract class or interface
'System.Drawing.Image'"
Could someone explain why? I mean, who said that I want GetImage() to create
an instance of "the abstract class Image"???
Note that the following compiles successfuly:
public abstract class AbstractClass
{
public abstract string GetText();
}
public interface IUseMyClasses
{
AbstractClass MakeObj();
}
Thanks,
--Horia (confused) Tag: FWD: Take a look at the package Tag: 58181
beginner problem with a windows service
I am trying to write a windows service that sends emails to clients at
specific times based on information in a sql db. Since this is done for
multiple cities, I start a thread for each city and continue the processing
from each thread. My service starts fine (gives me no errors, etc), but it
doesn't seem to start the new threads. I am new to windows services, so I
don't know if I'm doing something wrong. Should I maybe be doing this with
events? Below is the code for the OnStart Method and the thread that is
supposed to start multiple times. If you need the rest of the code, email
me and I will send to you. Thanks.
Public MustInherit Class EmailPump : Inherits ServiceBase
Public Const TwentyFourHrs As Long = 86400 'There are 86,400 seconds in
24 hours
Private name As String
Private index As Integer
Private dbObj As RgsDbConnection
.....
Protected Overrides Sub OnStart(ByVal args() As String)
Dim i As Integer
Dim t(Me.dbObj.NumLocales - 1) As Thread
Dim log As EventLog = New EventLog()
log.WriteEntry(ServiceName, "Service started")
For i = 0 To Me.dbObj.NumLocales - 1
Me.index = i
t(i) = New Thread(AddressOf MainLoop)
t(i).Start()
'spin until thread starts
While Not (t(i).IsAlive)
End While
'yield to other threads
Thread.Sleep(0)
Dim logEntry As String
logEntry = String.Format("Waiting to send emails and " _
+ "faxes for {0}.", dbObj.Locale(i))
log.WriteEntry(ServiceName, logEntry)
Next i
End Sub
Public Sub MainLoop()
Dim TimeDiff As Integer
Dim Interval As Integer
Dim i As Integer = Me.index
Dim secsFromMidnightToGo As Integer
Dim secsFromMidnightToNow As Integer
secsFromMidnightToGo = CInt(DateDiff("s", CDate("12/30/1899 12:00:00
AM"), _
Me.dbObj.GoTime(i)))
secsFromMidnightToNow = CInt(DateDiff("s", TimeOfDay, Today))
Dim hrs, mins, secs As Integer
Do
If secsFromMidnightToNow > secsFromMidnightToGo Then
TimeDiff = secsFromMidnightToNow - secsFromMidnightToGo
Interval = (TwentyFourHrs - TimeDiff) * 1000 'miliseconds
ElseIf secsFromMidnightToGo > secsFromMidnightToNow Then
TimeDiff = secsFromMidnightToGo - secsFromMidnightToNow
Interval = TimeDiff * 1000
End If
Dim log As EventLog = New EventLog()
Dim logEntry As String
secs = ((Interval / 1000) Mod 3600) Mod 60
mins = (((Interval / 1000) - secs) Mod 3600) / 60
hrs = ((Interval / 1000) - secs - (mins * 60)) / 3600
logEntry = String.Format("Waiting for {0}hrs, {1}min " _
+ "and {2} sec to send emails and faxes for {3}.", _
hrs, mins, secs, Me.dbObj.Locale(i))
log.WriteEntry(ServiceName, logEntry)
Thread.Sleep(Interval)
logEntry = String.Format("Sending emails for {0}...", _
Me.dbObj.Locale(i))
log.WriteEntry(ServiceName, logEntry)
Me.dbObj.SendEMails(i)
logEntry = String.Format("Done sending emails for {0}", _
Me.dbObj.Locale(i))
log.WriteEntry(ServiceName, logEntry)
logEntry = String.Format("Sending faxes for {0}...", _
Me.dbObj.Locale(i))
log.WriteEntry(ServiceName, logEntry)
Me.dbObj.SendFaxes(i)
logEntry = String.Format("Done sending faxes for {0}", _
Me.dbObj.Locale(i))
log.WriteEntry(ServiceName, logEntry)
Loop
End Sub
..... Tag: FWD: Take a look at the package Tag: 58180
no-touch [Web/Internet] deployment...
Greeting All,
OK I keep reading about no-touch deployment so I visited
http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vbtchNo-TouchDeploymentInNETFramework.asp?frame=true
downloaded the sample, and I'll be damned if everything went Ok up until the
final step to test by hitting http://localhost/TaskMgmtWS/TaskManagement.exe
but what I get is the dreaded 'The page cannot be found'.
That app is in a configured Virtual Directory [default settings] in IIS [on
Windows 2K Advanced Server] called TaskMgmtWS and the Release builds of
TasksWS.dll and TaskManagement.exe are in the folder. When folder browsing
is turned on I can even see the exe but I get the same error when I click
it. Also, opening the app directly [double click physical file in Windows]
works fine. I know this is something simple and I'm gonna be embarrassed by
the fix for it.
Thanks in advance everyone. Tag: FWD: Take a look at the package Tag: 58176
How to do bitwise shift in c#
How do I achive following:
MAKE_HRESULT(sev,fac,code)
((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16)
|((unsigned long)(code))) )
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: FWD: Take a look at the package Tag: 58175
Performance : PrintDocument / PrinterSettings / PaperSizes is very VERY **slow**
Hi,
I'm curious to know if I'm doing something wrong here, or if this is just
mind-numbingly slow for a reason.
In a simple WindowsFormsApplication:
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
PrintDocument printDoc = new PrintDocument();
// Add each papersize name (string) to an array
//
// Querying printer for all its papersizes is **Slow**
// - This loop takes about 8 seconds (!!) to execute on my machine for 14
sizes
ArrayList names = new ArrayList();
PrinterSettings printer = printDoc.PrinterSettings;
for( int i=0; i<printer.PaperSizes.Count; i++ )
{
PaperSize psize = printer.PaperSizes[i];
names.Add(psize.PaperName);
}
}
It appears that each call to printer.PaperSizes.xxxxx takes a very VERY long
time. I can speed that loop up by moving the printer.PaperSizes.Count up out
of the loop, but having to do this seems funky.
Am I missing something, or is this stuff just broken for speed?
Rob. Tag: FWD: Take a look at the package Tag: 58174
IsInRole not working across Domains
Hello,
I'm trying to use the WindowsPrincipal object in an
ASP.NET application. We have users all across the country
in many different domains (for an example, let say one is
called userDomain). We have set up Windows groups in a
different domain (let's call it groupDomain).
Here is my code for a user in the userDomain:
WindowsPrincipal myUser = User as WindowsPrincipal;
if (myUser.IsInRole(@"groupDomain\GroupOne"))
{
// user's name is userDomain\UserOne
Label1.Text = "User is In Role";
}
else
Label1.Text = "User NOT in Role";
My problem is that IsInRole ALWAYS returns false. It only
returns true if I ask about groups in the BUILTIN domain
or in the domain that the user belongs to (userDomain).
Further, when I look at the myUser object in the Locals
window after a call to IsInRole, I see the listing of
m_roles and I see none of the groupDomain roles. I've
tested this several different ways and it seems that
IsInRole only checks the domain that the user belongs to
as well as the built in groups.
Any Help? Tag: FWD: Take a look at the package Tag: 58173
Smart Client won't run until IE Cache cleared
[cross-posted on framework and windowsforms since I don't know where
to put it]
We can get our machines into states where our no-touch deployment
(href-exe) Windows Forms app won't run until we clear the IE cache
(Temporary Internet Files). This happens every few days on our
development machines.
When an exe link is clicked on or pasted directly into the address bar
it flashes "Loading..." on the status bar for a split second and
that's it. The assembly never makes it to Fusion or the assembly
download cache. Clearing the IE cache makes everything work again.
Any ideas on a workaround for this? Asking users to clear their IE
cache for our app to work is something we'd like to avoid.
Thanks,
Blake Tag: FWD: Take a look at the package Tag: 58172
Mouse driver for universal and intelligent scrolling behaviour with wheel
Hi!
I develop an application and I need a mouse driver for universal
and intelligent scrolling behaviour with wheel.
Something like the Microsoft IntelliMouse has.
Is something like that anywhere availabel?
regards,
gicio Tag: FWD: Take a look at the package Tag: 58171
Serialize and SetValue
Hi,
I try to serialize a control property (System.Web.UI.WebControls.Style) to
store it in my DB. But it can't be serialized. So a wonderfull idea would be
to create my own object with [Serializable] Attribute. This would work in
most cases but not in my case. I need to deserialize the object and set it
as a value on my webcontrol.
Example:
Serialize - System.Web.UI.WebControls.Style - and store it in DB
objValue = Deserialize - System.Web.UI.WebControls.Style - from DB
:code
TextBox txt = new TextBox();
System.Type typ = txt.GetType();
System.Reflection.PropertyInfo PropInfo = typ.GetProperty("Height");
PropInfo.SetValue(objCurrentControl, objValue,null);
The serialization of System.Web.UI.WebControls.Style will fail. If I create
my own class it will not be possible to use SetValue. Is this correct and is
there a workaround? Or is there another Idea?
thx in advance
Bjoern Wolfgardt Tag: FWD: Take a look at the package Tag: 58163
Help !
I have a database in Oracle, which i have converted to Access1
database. The client has his own Access2 Database. I want to transfer the
data from the Access1 database to Access2 database. The Access2
database has the tables of Access1 database and addditional tables. This
wil have to be done at regular intervals.
How can I do this through code ?
TIA,
Gary Tag: FWD: Take a look at the package Tag: 58161
Server Side Validation
I have an ASP.NET app that has server side validation.
This app needs to run in IE and Netscape.
The validation(required field validators) does not work at
all in Netscape.
I have my Target Schema set to IE and Netscape.
Any help or advice on this is much appreciated?
Do I have to rewrite my validation in Javascript?
My project goes live in 2 days.
C Tag: FWD: Take a look at the package Tag: 58151
Access denied
I get very fustrated because I get ACCESS DENIED when I
establish a new web site an try to run a new application.
I have done this mistake on time before, but i cant
remember whats the trick ????????
All permission are properly set
All other webs and applications are running ok....
Please ????????
Leif H. Tag: FWD: Take a look at the package Tag: 58141
What TextBox Event to track when the user press the "enter" key
I have a text box. I want to do some processing after the
user enters some data to the text box and press
the "enter" key. What TextBox event do I have to track to
detect this event? Tag: FWD: Take a look at the package Tag: 58140
Calling InvokeMember from transparent proxy
Hi all,
I'm trying to call methods of a remote server using
reflection but
always get a MissingMethodException, saying that the
requested method
cannot be found.
In detail:
I have a server Svr which extends the interface ISvr. Svr
and ISvr are
implemented in different assemblies "Interface.dll"
and "Svr.dll".
I have a client which uses methods of Svr in two different
ways:
a) Directly:
Svr.Foo();
b) Via Reflection:
Svr.GetType().InvokeMember("Foo",
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.InvokeMethod,
null, Svr, null);
There are 2 scenarios:
1. Directly, NON-Remoting:
The client has a direct reference to "Svr.dll". Both calls
work
perfectly.
2. Remoting, local machine, TCP channel:
The client creates a transparent proxy of ISvr using the
RemotingHelper class of Ingo Rammer:
ISvr svr = (ISvr)RemotingHelper.GetObject(typeof(ISvr));
In this case, direct calls to the server work fine, but
the calls
using InvokeMember throw a MissingMethodException.
After two days of research, I'm at a loss. Has anyone out
there an
idea?
Thanks in advance
Uli Proeller
prosa GmbH, Germany Tag: FWD: Take a look at the package Tag: 58137
Problem after update from Framework1.0 to 1.1
Hi there!
After I installed Visual studio 2003 and Framework 1.1. on my Computer
and reverted my Project to VS 2003 I get this Error:
Invalid file name for monitoring: 'c:\inetpub\wwwroot\VR\http:'. File
names for monitoring must have absolute paths, and no wildcards.
I've debugged it and the Error is when I'm trying to read from
Web.Config file like this:
_args.AdditionalInfo =
System.Configuration.ConfigurationSettings.AppSettings["MemberFees"];
The strange thing is that when the aspx page loads then I'm also
reading from this same Web.config file this same AppSettings, and that
does not return an error!!
Can anyone help me, please! I can not revert to Framework 1.0 because
of another project that depends on it!!
VEV Tag: FWD: Take a look at the package Tag: 58136
Constructor with identical signature
Hi all,
All constructors must have different signatures, but sometimes come upon a
situation where I would like to create to constructors with the same
signature - i.e.:
Public Sub New(integer1 as Integer)
End Sub
Public Sub New(integer2 as Integer)
End Sub
I guess this is a situation a lot of developers knows and I was wondering
what everone else does in such a situation and if there is some kind of best
practice that one should use?
Regrads,
Sune Tag: FWD: Take a look at the package Tag: 58135
Garbage collector has problems with ADO-MD interop
Our ADO-MD application sometimes gives the
exception 'Object is no longer valid'.
You can reproduce the problem using the following code.
Module main
'When "enable optimizations" is set and the code is
'not run in the Visual Studio IDE, the following code
'gives the exception 'object is no longer valid'.
'The aim of GC.Collect() is to make the bug reproducible.
Public Sub main()
Try
Dim MyConnection As New ADODB.Connection
Dim MyCellset As New ADOMD.Cellset
Dim MyPosition As ADOMD.Position
Dim Dummy As String
MyConnection.Open("provider=msolap;data
source=localhost;initial catalog=Foodmart 2000")
MyCellset.Open("select Time.Year.Members on 0 from
[Sales] where [Unit Sales]", MyConnection)
For Each MyPosition In MyCellset.Axes(0).Positions
GC.Collect() : GC.WaitForPendingFinalizers()
Dummy = MyPosition.Members(0).UniqueName
Next
Catch ex As Exception
MsgBox("Message:" + ex.Message + vbCrLf + "Source:"
+ ex.Source + vbCrLf + "StackTrace:" +
ex.StackTrace, , "Exception")
End Try
End Sub
End Module
When I replace the for-each loop with an index loop, the
code runs fine. Should I replace all for-each loops with
index loops in our application?
Sincerely,
Elyo Ravuna Tag: FWD: Take a look at the package Tag: 58128
Recovering from "Out of disk space" exception.
I'm trying to do what I'd thought would be an extremly
simple disk operation. Writing a number of lines of text
to a text file.
My problem occurs when trying to handle an Out of Disk
Space Exception. The following is a simplified snippet
that shows my problem.
<C# code snippet>
StreamWriter sw = File.CreateText(@"A:\Test.txt");
try
{
for (int i=0; i<100; i++)
{
sw.WriteLine("Some text gets writen here.");
}
sw.Flush();
sw.Close();
}
catch(Exception)
{
// Want to close and then delete the empty file here.
MessageBox.Show("Caught an exception");
}
<End C# code>
When I catch the exception, I want to be able to close
off the file, and then delete the empty file created.
What happens is that any attempt to close the file causes
another exception as .NET trys to the flush the buffer to
disk. And if I don't close the file, I can't delete it,
and the garbage collector will trigger the exception
again some random time after the code leaves scope.
I can prevent the garbage collection causing another
exception by suppressing finalization, but thats rather
ugly, and still doesn't allow me to remove the file.
I've tried varients like using a FileStream, and writing
the text out byte by byte, but still get the same
behaviour.
Any suggestions appreciated.
Dougal. Tag: FWD: Take a look at the package Tag: 58113
BeginReceiveFrom gets empty data after second packet.
I'm putting some Asyncronous socket stuff into one of my applications. And
I'm having a bit of trouble with Udp Asyncronous sockets BeginReceiveFrom()
method. In my application I have an app that receives stock ticks from from
a feeder service. That data then gets massaged and then notifications are
sent to Clients that are viewing stock data. The Clients have a class that
they will use to talk to the Feeder Service. When they first initialize the
client, the client broadcasts a "HELO" command to find a feeder. Then if a
feeder hears it, it will send a "HERE" command. The client will then start
sending Watch commands to the Feeder service via UDP, after it receives the
"HERE", command. If the client doesn't get a "HERE" it will keep sending
"HELO" at a specified interval, until a Feeder Responds with "HELO". Then
when the Feeder Service gets a symbol updae that has a watch on it, it will
broadcast it to the clients.
The problem I have, is that After the client receives the "HERE" packet
command, all remaining packets that arrive using the BeginReceiveFrom() have
an array full of 0 bytes. I check the messages that are being sent by the
Service, and they seem fine. But all remaining data seems to be empty. the
interesting thing is, the packets are the correct size that were sent, it's
just that all the data in it is 0.
Here some code for you examination... (slighly abbreviated to make it easier
to read (?))
//using directives and whatnot......
/// <summary>
/// Class for Feeder Clients to use to connect and receive network updates
from the feeder.
/// </summary>
public class FeederNetClient
{
private Socket udpSocket;
private byte[] buffer;
private EndPoint serverEndpoint = null;
private IPAddress serverIp = null;
private bool listening = false;
private int protocolNum = 1;
private bool feederFound = false;
private int heloResendInterval = 60000;
private int version = 1;
/// <summary>
/// A default constructor. Nothing really happens here.
/// </summary>
public FeederNetClient()
{
}
/// <summary>
/// Initializes the Sockets and begins sending out the HELO broadcast.
/// </summary>
public void InitializeClient()
{
//setup the module endpoints
IPEndPoint endPoint = new IPEndPoint(IPAddress.Any,
NetworkUtil.MmksPortNum);
//Set up the UdpSocket
this.udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
this.listening = true;
this.sendHelo();
this.beginSocketListen(this.udpSocket);
}
/// <summary>
/// Used to stop all network communication. it also resets the state
/// of the client.
/// </summary>
public void Shutdown()
{
if(this.listening)
{
this.listening = false;
this.feederFound = false;
udpSocket.Shutdown(SocketShutdown.Both);
}
}
private void beginSocketListen(Socket listeningSocket)
{
//The buffer to be filled
this.buffer = new byte[1024];
//setup the remote endpoint
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
this.serverEndpoint = (EndPoint)(sender);
//start up to begin receiving.
listeningSocket.BeginReceiveFrom(this.buffer, 0, this.buffer.Length,
SocketFlags.None, ref this.serverEndpoint, new AsyncCallback(dataReceived),
listeningSocket);
}
/// <summary>
/// Private utility method that is a callback for the
/// BeginSendTo method on sockets.
/// </summary>
/// <param name="result">IAsyncResult object used in the Callback from the
Asyncronus
/// BeginSendTo method.</param>
private void messageSent(IAsyncResult result)
{
Socket client = (Socket)result.AsyncState;
int sent = client.EndSendTo(result);
if(sent <= 0)
throw new ApplicationException("The Object couldn't be sent.");
this.buffer = new byte[1024];
client.BeginReceiveFrom(this.buffer, 0, buffer.Length, SocketFlags.None, ref
this.serverEndpoint, new AsyncCallback(dataReceived), client);
}
/// <summary>
/// Private callback method for when data is received using the
BeginReceiveFrom
/// method. This method also breaks down and parses Protocol messages, and
handles commands.
/// </summary>
/// <param name="result">IAsyncResult object used in the Callback from the
Asyncronus
/// BeginReceiveFrom method.</param>
private void dataReceived(IAsyncResult result)
{
//grab the socket
Socket handler = (Socket) result.AsyncState;
// get the length of bytes received.
int bytesRead = handler.EndReceiveFrom(result, ref this.serverEndpoint);
// is there data in the buffer?
if(bytesRead > 0)
{
//NOTE to readers: This is where i have the trouble. The bytes read is fine,
but the data is all 0's
// This happens after the code passes through here a second time.
//check for the header type info
int headerBlock =
IPAddress.NetworkToHostOrder(BitConverter.ToInt32(this.buffer, 0));
int protocol =
IPAddress.NetworkToHostOrder(BitConverter.ToInt32(this.buffer, 4));
//make sure it's correct
if(headerBlock.Equals(NetworkUtil.MmksPacketID) &&
protocol.Equals(this.protocolNum))
{
//Get the version number of the protocol
int version = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(this.buffer,
8));
if(version == 1)
{
IPAddress address = ((IPEndPoint)this.serverEndpoint).Address;
this.notifyConsumer(String.Format("Received message from {0}",
address.ToString()), 1, NotificationType.Information);
//now grab the payload
byte[] payload = new byte[bytesRead - 12];
Buffer.BlockCopy(this.buffer, 12, payload, 0, bytesRead - 12);
//check the command header
string command = Encoding.ASCII.GetString(payload, 0, 4);
switch(command)
{
case "HERE":
{
this.serverIp = address;
this.feederFound = true;
break;
}
case "ACKW":
{
break;
}
case "OBJT":
{
byte[] payloadSansCommand = new byte[payload.Length - 4];
Buffer.BlockCopy(payload, 4, payloadSansCommand, 0, payload.Length - 4);
ReadObject(payloadSansCommand);
break;
}
}
}
else
throw new ApplicationException("Unhandled Protocol version"); //TODO: make a
better Exception Class for this.
}
}
//Set up to receive again
if(this.listening)
{
this.buffer = new byte[1024];
handler.BeginReceiveFrom(this.buffer, 0, buffer.Length, SocketFlags.None,
ref this.serverEndpoint, new AsyncCallback(dataReceived), handler);
}
}
/// <summary>
/// private utility method that is used to send out the HELO broadcast.
/// This broadcast is for the client to look for a Feeder Service.
/// </summary>
/// <param name="source">object contect for a called timer event.</param>
/// <param name="e">The timer event Arguments.</param>
private void sendHelo()
{
if((!this.feederFound) & this.listening)
{
//setup the broadcast endpoint
IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Broadcast,
NetworkUtil.MmksPortNum);
//set up the HELO brodcast packet
string heloCommand = "HELO";
int heloByteSize = Encoding.ASCII.GetByteCount(heloCommand);
byte[] header = NetworkUtil.MmksPacketHeader(this.protocolNum,
this.version);
byte[] packet = new byte[header.Length + heloByteSize];
Buffer.BlockCopy(header, 0, packet, 0, header.Length);
Encoding.ASCII.GetBytes(heloCommand, 0, heloCommand.Length, packet,
header.Length);
//Set the options to allow broadcast
this.udpSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.Broadcast, 1);
// send the helo broadcast
this.udpSocket.BeginSendTo(packet, 0, packet.Length, SocketFlags.None,
ipEndPoint, new AsyncCallback(endSendHelo), udpSocket);
this.notifyConsumer("Sending HELO broadcast...", 1,
NotificationType.Information);
}
}
private void endSendHelo(IAsyncResult result)
{
Socket client = (Socket)result.AsyncState;
int sent = client.EndSendTo(result);
if(sent <= 0)
throw new ApplicationException("HELO was not sent correctly.");
System.Threading.Thread.Sleep(this.heloResendInterval);
this.sendHelo();
}
}
I didn't include everything. This may even be a bit too much but I wanted to
keep some of it so make sure i might not have missed something.
Any help is greatly apprecaited.
Sean. Tag: FWD: Take a look at the package Tag: 58088
using xml schema with xmlDOm in .net
hello 1
i use an xml documet with xml schema but when i try to use XPath
(selectnodes) it retrieves empty list.
when i remove the schema (the 'xmlns="http..."')
i get the data.
how can i handle this ?
using xmlDocument.documentElement.selectNodes("PROP")
something like this:
<OBJ xmlns="http://tempuri.org/obj.xsd">
<PROP NAME="x"/>
<PROP NAME="y"/>
</OBJ>
this not working (return empty nodelist)
but this:
<OBJ>
<PROP NAME="x"/>
<PROP NAME="y"/>
</OBJ>
is working and return the data. Tag: FWD: Take a look at the package Tag: 58084
VT_PVARIANT, Is this a bug?
I just used VS .NET 2003 to create an ATL project with one Simple COM object
which supports ConnectionPoints. I added one event lets; say
Notify(VARIANT* pDisp, BSTR* bstrName).
Then I chose "Add Connection Point" for the IDE to create the Fire_xxx
functions for me. From here on when I compile I get error.VT_PVARIANT and
VT_PBSTR not defined
I looked at the implementation of Fire_Notify() function and noticed that
the IDE has generated this code form:
.....
avarParams[1].vt = VT_PVARIANT;
....
avarParams[0].vt = VT_PBSTR;
...
hr = pConnection->Invoke(1, .....
....
I cannot find where VT_PVARIANT and VT_PBSTR are defined. I fixed the
problem by changing that to VT_VARIANT | VT_BYREF and VT_BSTR | VT_BYREF and
now it works.
Why the hell the IDE Wizard is putting the code that it cannot compile. Is
this some bug???
thanks insdvance, Tag: FWD: Take a look at the package Tag: 58083
VB 6 and .NET on single machine
Hi,
Does VB 6 and .Net work on same machine without problems?
thanks
Megan Tag: FWD: Take a look at the package Tag: 58077
How could the IRR function be called in C#
Dear Authorities:
Could you advise as to the syntax to call IRR in C#, and
what namespace would be required.
Sincerely,
Burton G. Wilkins Tag: FWD: Take a look at the package Tag: 58074
System.UnauthorizedAccessException
This one is from visual studio .net 1.1,
"A first chance exception of
type 'System.UnauthorizedAccessException' occurred in
pslimsmanager.dll
Additional information: Access is denied."
and this is the associated error in the application log,
Access denied attempting to launch a DCOM Server using
DefaultLaunchPermssion.
Can anyone suggest where to start troubleshooting this
error? Tag: FWD: Take a look at the package Tag: 58073
Custom User Controls and dynamically created web controls events not firing
I have a peculiar problem and since I am just starting to use .net I
am confident I am doing something wrong, but I can't see it and I've
wasted a lot of time so far trying to figure it out. Hopefully one of
you can figure it out.
I have a custom User Control and I am dynamically creating a
RadioButtonList. If I remove the custom user control from the page the
RadioButtonList works as expected and correctly. However, once I add
the custom control, it does not fire the SelectedIndexChanged event.
Below is the code. If all I do is remove: "<UC:TOPMENU id="TopMenu1"
runat="server"></UC:TOPMENU>", everything works properly. If it's
there, "rMrktChooser_SelectedIndexChanged" is never executed. I've
tried breakpoints, etc. And, AutoPostBack is True of course.
Thanks in advance!
***** ASPX page *****
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="DefaultPage.aspx.vb" Inherits="WebApp.DefaultPage"%>
<%@ Register TagPrefix="UC" TagName="TopMenu"
Src="Controls/top_menu.ascx" %>
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:placeholder id="UCContainer" runat="server"></asp:placeholder>
<UC:TOPMENU id="TopMenu1" runat="server"></UC:TOPMENU>
<asp:Label id="Label3" style="Z-INDEX: 104; LEFT: 23px; POSITION:
absolute; TOP: 163px" runat="server"
Width="368px" EnableViewState="False"></asp:Label>
</form>
</body>
</HTML>
***** CODE-BEHIND *****
' Added by hand for access to the form.
Protected Form1 As System.Web.UI.HtmlControls.HtmlForm
' Added by hand; will create instance in OnInit.
Protected WithEvents rMrktChooser As
System.Web.UI.WebControls.RadioButtonList
Protected WithEvents UCContainer As
System.Web.UI.WebControls.PlaceHolder
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
rMrktChooser = New RadioButtonList
rMrktChooser.Items.Add(New ListItem("By Market", "Market"))
rMrktChooser.Items.Add(New ListItem("By DRA", "DRA"))
rMrktChooser.ID = "rMrktChooser"
rMrktChooser.AutoPostBack = True
rMrktChooser.EnableViewState = True
UCContainer.Controls.Add(rMrktChooser)
InitializeComponent()
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
' Set the initial properties for the radion button list.
rMrktChooser.SelectedIndex = 0
End If
End Sub
Private Sub rMrktChooser_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
rMrktChooser.SelectedIndexChanged
Dim radioSender As RadioButtonList
Dim strRadioID As String
radioSender = CType(sender, RadioButtonList)
strRadioID = radioSender.ID
Select Case strRadioID
Case "rMrktChooser"
Label3.Text = "RadioButtonList text was changed"
End Select
End Sub Tag: FWD: Take a look at the package Tag: 58072
Calling a Method Using Reflection
Hi,
How do I call a method which takes a ref parameter using Reflection ??
Thanks,
Vikram Tag: FWD: Take a look at the package Tag: 58060
SoapHeader Required=true not working
I've got the following soap header attribute set:
[WebMethod]
[SoapHeader("m_UserInfo", Direction=SoapHeaderDirection.In, Required=true)]
public void SetTest()
{
...
}
The bad thing is, the requirement isn't working: the client can call the
method without the setting the header. What's missing???
Thanks Tag: FWD: Take a look at the package Tag: 58059
Type Casting at Runtime .Net
Language: VB.NET (could apply to C#)
Hey,
I am working on a component that will take any of the ADO.Net
connection Classes, OleDb, ODBC, SQL, and Oracle, and return the
appropriate Command Object for that type of connection. I have this
working successfully, but I am running into one flaw. I would like to
use Option Strict on the project, (which I assume will make the code
run faster).
But, in order to achieve this ability to return a Command Object at
runtime, I am forced to return the Object as a System.Object. From
there, I can not run the ExecuteReader method, or any of the other
methods on the object, if the Option Strict is enabled. I have tried
using the GetType method with CType, DirectCast and
'System.ComponentModel.TypeConverter' ConvertTo method with no luck.
My question boils down to this: Is there a way to perform Type
Casting by referencing the objects Type (GetType) and then performing
a type-cast at runtime?
I know this may sounds/seem a bit odd, but I was hoping it would be
possible since all of the Command Objects under .Net are written with
the same Methods (Thanks to microsoft for that). Any information would
be appreciate, Thanks
-Kevin Tag: FWD: Take a look at the package Tag: 58058
Support for Windows 2003 Enterprise
I am developing a component that will in some cases use
approximately 2-3GB (depends on content) of memory. Does
either version of the framework support the 3GB switch on
any supporting version of Windows 2003 Enterprise. We
are considering upgrading our Dell 2650 to 8GB RAM and
Windows 2003 Enterprise, but I don't know if that will
actually get us anything until 64-bit comes out (on
Opteron). We have tuned the component as much as possible
using a virtual object/byte array design that is about as
conservative as you can get with .NET (approx. 59.001
bits per 59 bits of data). Hardware is almost always
cheaper than development so we are investigating possible
hardware/software upgrades prior to using a disk-based
approach.
Any help is greatly appreciated,
mark Tag: FWD: Take a look at the package Tag: 58056
Smart Device option does not appear in Visual Studio .NET
As I've read elsewhere, I do not have the icons/options to create a
Smart Device application in my freshly-installed (and repaired and
re-installed) copy of Visual Studio .NET 2003 Pro. I re-ran the setup
program, and it also does not contain an option to select Smart
Devices anywhere in the modules/options screen. I have installed the
language for Visual Basic .NET (leaving out C++ and C#) as well as
many of the other add-ons and from what I read, that should be enough
to perform development for my Axim X5 platform.
I also installed the .NET Compact Framework 1.0 SP 1 Redistributable,
and the Pocket PC 2003 SDK in the hopes that they would add something
I needed behind the scenes.
Can anyone suggest to me why this does not appear, and how to fix it? Tag: FWD: Take a look at the package Tag: 58055
Converting absolute path to relative
Hi,
assume I have two paths referring to files on the same
logical volume, like "C:\Home\Dir1\file1.txt"
and "C:\Home\Dir2\file2.txt". How can I convert the
second absolute path to a relative path based on the
first one, like "..\Dir2\file2.txt"? I'm looking into the
System.IO.Path class but can't find an answer...
Thanks in advance,
Dmitry Tag: FWD: Take a look at the package Tag: 58053
Installation error from .net framework 1.1 and 2
I'm getting a reproducible error from when I installed the .Net
Framework 1.1 upgrade and when I try to run a pgm that I think uses it.
The error is:
Fatal execution engine error 0x7926e693
I am running WinXP Pro SP1 on a P4.
What's up?
Thanks Tag: FWD: Take a look at the package Tag: 58052
DataList Wrapping
Everyone,
Is there a way to set a horizontally repeating DataList to wrap after a
certain number of iterations.
Current:
1 2 3 4 5 6 7 8 9 10
Would like to see:
1 2 3 4
5 6 7 8
9 10
Thanks,
Jim Tag: FWD: Take a look at the package Tag: 58050
Help on C#
hi,
i wrote one small application in C# and compiled into
command prompt.
but i am getting one error i.e mscorlib.dll could not be
opened - no such interface supported.
plz suggest anyone for me.how can i rectify this error.
thanks in advance
Regards
Naren Tag: FWD: Take a look at the package Tag: 58044
BUG Report. Please confirm.
Hi,
I'm previously haunted by a bug which is now in Knowledge Base Article
818587 (Fix: Regression in Dataset Serialization in Visual Studio .NET 1.1
when a datarow contains a rowError or a ColumnError Property) which can be
found at http://support.microsoft.com/default.aspx?scid=kb;en-us;818587.
Please note that this bug only shows itself if the Windows Form Application
is run on dotNetFramework 1.1 but does not shows itself if the same
application is forced to run on dotNetFramework 1.0
Now, I think I found another bug which produces the same error message as
the bug above and it also has something to do with the rowError or a
ColumnError property. Even worse, the bug exists in dotNetFramework 1.1 and
also dotNetFramework 1.0. The error message is,
System.InvalidOperationException: There is an error in XML document (x,
xxxx).
---> System.NullReferenceException: Object reference not set to an
instance of an object.
To reproduce the bug,
1. Create a Web service with a dummy method.
<WebMethod()> Public Function Dummy(ByVal ds As DataSet) As DataSet
Return ds
End Function
2. Create a Windows Application or a Console Application and add the service
that you created in step 1 as a Web Reference.
3. Type in or paste the following code,
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet
Dim dt As DataTable
Dim row As DataRow
Dim i As Integer
' Create a new DataTable
dt = New DataTable
dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))
' Create a new DataSet and add the DataTable into it
ds = New DataSet
ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)
' Fill the DataTable with dummy values
For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)
Next
' Set error message to the rows
For Each row In ds.Tables("TestTable").Rows
' Setting the RowError property below will cause and
' exception is thrown when calling ws.Dummy(ds.GetChanges).
row.RowError = "Row has not been updated to the server yet."
Next
' Send DataSet to the WebService
Try
ws = New localhost.Service1
ws.Dummy(ds.GetChanges)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
ws.Dispose()
End Sub
Can anyone confirm this? Thanks a lot. Tag: FWD: Take a look at the package Tag: 58043
SMTP Mail
Has anyone had any issues repeatedly sending SMTP e-mails from .Net?
I have a c# component that gets executed by multiple threads, and uses
SmtpMail.Send to send e-mails. Whilst in 80% of cases this works fine, I
sometimes get "Could not access 'CDO.Message' object" errors
The code in question is running as an AIC component under BizTalk.
The call stack is:
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
Thanks.
Kev. Tag: FWD: Take a look at the package Tag: 58033
.Net Remoting with Visual C++ .NET
Hi everybody.
Is there a way to use .NET Remoting with Visual C++ .Net?
In positive case, how to build the interfaces like they're
built in C#?
Thanks,
Moises. Tag: FWD: Take a look at the package Tag: 58031
Remoting & Terminal Server
We have two .NET desktop applications. The applications
communicate with eachother via .NET Remoting. Application
X marshals an object on a tcp channel. Application Y
connects to that object to communicate with X.
When we install those 2 applications on a Terminal Server
(Citrix), and we start 2 sessions, then the applications
work fine on the first session. X and Y can communicate
via .NET remoting.
On the second session, the 2 applications cannot
communicate. This is because the port that is used by the
tcp channel is already in use by the first session.
Is there a solution to this problem? So that various
desktop applications can communicate with eachother in one
session?
We finally want to have 2 desktop applications communicate
with each other on each session via .NET Remoting. Tag: FWD: Take a look at the package Tag: 58030
DLL Hell in .NET
What are the under-lying DLLs or libraries that .NET is sitting on which
after installing another program will cause the entire .NET Framework to
fail? Tag: FWD: Take a look at the package Tag: 58024
Not allowed to install the .Net Framework
Can anyone tell me the most common problems when
installing the .Net Framework on to a PC running Windows
2000 Server.
I am desparately trying to convince my boss that we need
to install it on to our web server but he is reluctant to
install anything that he deems as unnecessary after we had
a few problems installing Win 2000 service pack 4!
Until I can convince him I am stuck programming using the
old ways of looping through recordsets to create html
tables etc so any help would be GREATLY appreciated.
Andy Tag: FWD: Take a look at the package Tag: 58019
Someone can explain this???
Hi. I wonder if someone could explain why this code gives different results
in VB.NET and C#:
C#
public enum myEnum{
One = 1,
Two = 2
}
public void Foo(){
MessageBox.Show(Convert.ToString(myEnum.One));
}
The result of Foo is message 'One'
VB.NET
public enum myEnum
One = 1
Two = 2
end enum
public sub Foo()
MessageBox.Show(Convert.ToString(myEnum.One))
end sub
The result of Foo is message '1'
Thanks Tag: FWD: Take a look at the package Tag: 58016