| Create a string of n pixel width... |
|
 |
Index ‹ DotNet ‹ Visual C#.Net
|
- Previous
- 1
- ADO >> How do I detect a DBNull in a strongly typed DataSet?Although I am able to set a DateTime column to null, it throws an error when
I attempt to test for null... example
Column set to null as follows:
private void InitializePriorsPostedThruTest()
{
object[] key = {cbAgencyID.Value.ToString()};
TwsDS.twsAgencyRow r = (TwsDS.twsAgencyRow)
twsDS1.twsAgency.Rows.Find(key);
r.SetPriorsPostedThruNull();
}
And test for it here (Will ultimately be checking for dates that have been
set):
private void cbAgencyID_RowSelected(object sender,
Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e)
{
object[] key = {cbAgencyID.Value.ToString()};
TwsDS.twsAgencyRow r = (TwsDS.twsAgencyRow)
twsDS1.twsAgency.Rows.Find(key);
if (r.PriorsPostedThru.Value == DBNull.Value)
MessageBox.Show("Null detected");
}
- 2
- Visual C#.Net >> OOD QuestionThis is a design / inheritance qus.
I have class Task.
This is a base class for some specific tasks
Say
WorkOrderTask : Task
TimeSheetTask : Task
Now Task has a function GetDetails() which gets all info about task. This
makes a database call.
I override this in the derived class. For implementing this in derived
class i see following 2 approaches.
Approach 1. WorkOrderTask .GetDetails()
{
Calls base.GetDetails(); to get base details, populates in the
object
Gets details specific to WorkOrderTask, populates in the object
returns;
}
Approach 2. WorkOrderTask .GetDetails()
{
Get details specific to WorkOrderTask as well as the base class
details, populates in the object
returns;
}
The problem with
Approach 1
I have to make 2 database calls.
Approach 2
If theres some change in base class I need to take care of these in all the
derived classes as well.
Whereas, Approach 1 is advantageous here as by modifying only the
Task.GetDetails funciton ( this is the base class ) function i have all the
values and i do not need to touch the derived classes.
Was thinking this might be a very common problem, so perhaps many of might
be able to guide me on the approach i must take here. Perhaps anything other
then the two i have talked about.
Thanks in advance
Sourabh
- 3
- Visual C#.Net >> Getting the COM IDataObject interface from the DataObject classThe .Net DataObject class implements the COM/OLE IDataObject interface , so
how do I get it.
I have tried this, but it does not work :
// Declare the COM/OLE IDataObject interface
[ComImport, Guid("0000010E-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleDataObject
{
[PreserveSig]
int OleGetData(FORMATETC pFormatetc, [Out] STGMEDIUM pMedium);
[PreserveSig]
int OleGetDataHere(FORMATETC pFormatetc, [In, Out] STGMEDIUM pMedium);
[PreserveSig]
int OleQueryGetData(FORMATETC pFormatetc);
[PreserveSig]
int OleGetCanonicalFormatEtc(FORMATETC pformatectIn, [Out] FORMATETC
pformatetcOut);
[PreserveSig]
int OleSetData(FORMATETC pFormatectIn, STGMEDIUM pmedium, int fRelease);
[return: MarshalAs(UnmanagedType.Interface)]
IEnumFORMATETC OleEnumFormatEtc([In, MarshalAs(UnmanagedType.U4)] int
dwDirection);
[PreserveSig]
int OleDAdvise(FORMATETC pFormatetc, [In, MarshalAs(UnmanagedType.U4)] int
advf, [In, MarshalAs(UnmanagedType.Interface)] object pAdvSink, [Out,
MarshalAs(UnmanagedType.LPArray)] int[] pdwConnection);
[PreserveSig]
int OleDUnadvise([In, MarshalAs(UnmanagedType.U4)] int dwConnection);
[PreserveSig]
int OleEnumDAdvise([Out, MarshalAs(UnmanagedType.LPArray)] object[]
ppenumAdvise);
}
-------------------
DataObject data = new DataObject();
IOleDataObject ido = data as IOleDataObject
--------------
When this is run, ido is null. I have also tried varrious other methods like
using Marshal.GetIUnknownForObject, Marshal.QueryInterface,
Marshal.GetTypedObjectForIUnknown, but none of the approaches work.
What am I doing wrong?
Thanks
Bob
- 4
- Microsoft Project >> Predecessors are not updatingHi!
I'm using project to schedule out a production chart for 64 units of the
same vehicle.
I have a task "Final Paint" which I have needed to move from prior to Item
46"Inspection" to after Item 46"Inspection". I can move the task with no
trouble, but when I try to update its predecessor to be Inspection (which is
now Item 45), The start date for Final Paint doesn't change.
I have tried entering other tasks as the predecessor to try and get this
line to change "eg predecessor 16FS" and still the this item will not follow
on.
Is this a known problem with project 2003, or am I doing something wrong?
Usually I can manually enter "line no"FS without any trouble.
Please help, thanks in advance....
Susie
- 5
- Visual C#.Net >> Obtain parameter values from methodHow would one obtain the parameter VALUES of a method that has already run?
I can find the method using the StackTrace and StackFrame classes but once I
find the method I would like to obtain the value of one of the parameters
that were passed to the method. Is this possible? Even if I have to use
PInvoke to do so?
I can currently find the parameter TYPEs using reflection but I can not
figure out to obtain the values.
Thanks,
Matt
- 6
- Visual C#.Net >> webclient timeouti am a newbie, i want to write a code to download data from web using
webclient
string HTMLstring = "";
WebClient client = new WebClient();
Byte[] HP = client.DownloadData("http://www.microsoft.com");
HTMLstring = Encoding.ASCII.GetString(HP);
is it possible to add a timeout timer for this code, e.g. 10s
or i must use another class, like webrequest to doing so?
Thanks for your help!!
- 7
- Dotnet >> LNK2001 with mixed managed/native dll'sHello,
I'm running into a linking problem when trying to build a dll like so...
step1:
native C++ library & managed c++ = managed c++ dll (this one builds fine)
step 2:
managed c++ dll (the one that built ok) & managed c++ = managed c++ dll
step 2 results in this link error...
error LNK2001: unresolved external symbol "public: bool __thiscall
rw::audio::core::System::IsLocked(void)const "
(?IsLocked@System@core@audio@rw@@$$FQBE_NXZ) SpliceUnity.obj
...among others. The one thing I noticed that is similar between all of
these link errors is that the routines they are refering to are const
methods.. for example...
bool IsLocked() const;
Any methods that are not const link fine. By the way, these routines are in
the native c++ library.
Another strange bit of info, if I use the routine IsLocked in both managed
c++ libraries, the one in step 1 still builds fine, and the link errors show
up when linking step 2. If I comment out all of the references to IsLocked
in the step 2 dll, I still get the link error until I comment out the call to
IsLocked in the step 1 dll. Once they are removed from BOTH managed
libraries, the link error disappears.
I've scowered the web but can't find a resolution to this. I'm wondering if
the const at the end of these methods, or the calls to those routines from
within my managed dll's are causing the two to be mangled differently (maybe
using __clrcall instead of __thiscall).
Any help is greatly appreciated.
Thanks
- 8
- Visual C#.Net >> Help: Can't use "Not"???I want to set the enabled property of a text box based on if a checkbox is
checked or not. This works....
txtPort.Enabled = ckDefaultPort.Checked;
But, I want the enabled property to be the opposite of the checked value.
Why doesn't this work?
txtPort.Enabled = Not ckDefaultPort.Checked;
It keeps telling my "; expected".
Thanks.
- 9
- ADO >> Which control to use?Hi
I need a layout like this http://www.infovis.biz/listview.jpg which is an MS
Access list box. Which control in vs2008 allows me to do this? The list is
being filled from an underlying table.
I would appreciate a code example if possible.
Many Thanks
Regards
- 10
- Winforms >> Unknown name of a componentHello Developpers,
I would like to learn the name of a component and where to obtain it to use at my project's forms.
When you open the Task Manager of Windows 2000/XP, etc., you see the CPU Usage History and Memory Usage History on the graphical indicator. This indicator like the osiloscopes's display.
If you know the name of this component, please kindly tell me....
I would like to thank You in advance for your sincere considerations.
Sincerely
- 11
- Visual C#.Net >> get file names of filesSay I want to get the file name of C:\temp\something.xml and have that
put into a variable so I can encrypt the file and output it to
c:\temp\filename.enc. I have not found anything that solves this for
me.
I tired this
static void Main(string[] args)
{
string fileName = @("C:\","*.xml");
string path = @"C:\*.xml";
string result;
result = Path.GetFileName(fileName);
but that has to be static. Any help is appreciated.
- 12
- ADO >> Macro to Generate OleDbCommand for a Stored Procedure callAfter searching for just such a macro/tool, I decided to write one
myself. After writing one myself, I decided to post it for others who
might be searching as I was:
Here's the macro. Since clipboard access is not available in Visual
Studio Macros, it's based off the current selection. What I do is
select my stored procedure code in Visual Studio and run this macro.
The output is put into the Output window pane, and I copy and paste it
from there. It's already saved me hours and I only wrote it
yesterday.
Sky's the limit on customizing this thing. Just please let the world
know if you make some sort of massive improvement. It's just a Macro,
so make all the changes you want to suite your coding style, etc.
By default, if uses a connection object named "conn" and it calls
"ExecuteNonQuery". Also, as you can see, it converts the T-SQL types
that I had immediate need for to OleDbDataTypes. Add as needed. Go
to town!
(I hope word-wrappnig doesn't mess this all up...)
'-----------------------------------------------------------
' Select the entire stored procedure code and run this
Sub CraeteOleDbCommandFromSp()
Dim Win As OutputWindowPane = GetActivePane()
Dim StoredProcedure As String = DTE.ActiveDocument.Selection.Text
Dim RegExProcedure As Regex = New
Regex("procedure\s+(?<Name>[A-Za-z0-9_]+)\s+(?<Parameters>[/@A-Za-z\s/(/)0-9,]+?)[^A-Za-z0-9_]as[^A-Za-z0-9_]")
Dim M As Match = RegExProcedure.Match(StoredProcedure)
Dim spName As String = M.Groups("Name").Value
Dim spParameters As String = M.Groups("Parameters").Value
Win.Clear()
Dim RegExParameters As Regex = New
Regex("@(?<Name>[A-Za-z_0-9]+)\s+(?<Type>[A-Za-z0-9]+)\s*\(?(?<Length>[0-9]*)\)?\s*(?<Output>output|OUTPUT)?")
Dim MC As MatchCollection = RegExParameters.Matches(spParameters)
Win.OutputString("#region " & spName & " call generated by
CreateOleDbCommandFromSp macro" & vbCrLf)
Win.OutputString("OleDbCommand sp = new OleDbCommand();" & vbCrLf)
Win.OutputString("sp.Connection = conn;" & vbCrLf)
Win.OutputString("sp.CommandText = ""{? = CALL " & spName & "(")
Dim ParameterCount As Integer = MC.Count()
For Each M In MC
ParameterCount = ParameterCount - 1
If ParameterCount = 0 Then
Win.OutputString("?")
Else
Win.OutputString("?,")
End If
Next
Win.OutputString(")}"";" & vbCrLf)
Win.OutputString("sp.Parameters.Add(""@RetVal"",OleDbType.Integer);"
& vbCrLf)
Win.OutputString("sp.Parameters[""@RetVal""].Direction =
ParameterDirection.Output;" & vbCrLf)
For Each M In MC
Dim OleDbDataType As String = M.Groups("Type").Value
Select Case OleDbDataType.ToUpper()
Case "BIGINT"
OleDbDataType = "BigInt"
Case "INT"
OleDbDataType = "Integer"
Case "VARCHAR"
OleDbDataType = "VarChar"
Case "SMALLINT"
OleDbDataType = "Smallint"
Case "TINYINT"
OleDbDataType = "TinyInt"
Case "UNIQUEIDENTIFIER"
OleDbDataType = "Guid"
Case Else
OleDbDataType = M.Groups("Type").Value
End Select
Win.OutputString("sp.Parameters.Add(""@" &
M.Groups("Name").Value & """,OleDbType." & OleDbDataType)
If Not M.Groups("Length").Value = "" Then
Win.OutputString("," & M.Groups("Length").Value)
End If
Win.OutputString(");" & vbCrLf)
Next
For Each M In MC
If Not M.Groups("Output").Value = "" Then
Win.OutputString("sp.Parameters[""@" &
M.Groups("Name").Value & """].Direction = ParameterDirection.Output;"
& vbCrLf)
Else
Win.OutputString("sp.Parameters[""@" &
M.Groups("Name").Value & """].Value = " & M.Groups("Name").Value & ";"
& vbCrLf)
End If
Next
Win.OutputString("sp.Connection.Open();" & vbCrLf & "try" & vbCrLf
& "{" & vbCrLf)
Win.OutputString(vbTab & "sp.ExecuteNonQuery();" & vbCrLf)
Win.OutputString(vbTab & "if(
Convert.ToInt32(sp.Parameters[""@RetVal""].Value) != 0 )" & vbCrLf)
Win.OutputString(vbTab & vbTab & "throw new
ApplicationException(String.Format(""Execute of " & spName & " failed
with {0}"",Convert.ToInt32(sp.Parameters[""@RetVal""].Value)));" &
vbCrLf)
Win.OutputString("}" & vbCrLf & "finally" & vbCrLf & "{" & vbCrLf
& vbTab & "sp.Connection.Close();" & vbCrLf & "}" & vbCrLf)
Win.OutputString("#endregion" & vbCrLf)
End Sub
Function GetOutputWindow() As OutputWindow
Return DTE.Windows.Item(Constants.vsWindowKindOutput).Object()
End Function
Function GetActivePane() As OutputWindowPane
Return GetOutputWindow.ActivePane
End Function
- 13
- Winforms >> A Newbie QuestionHi All,
I'm trying to develop a prototype for a small Room Booking application. This
is a 3 tier application. The presentation layer consists of Windows Forms.
There will be multiple concurrent clients. The application needs transaction
supportivity.I thought of developing in .NET C#. The data base is going to
be SQL Server 2000.
I thought of following the design guidelines mentioned in the
MSDN,Application Architecture for .NET Designing Applications and Services
from Microsoft
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html
/distapp.asp).
I have some questions. For my distributed application which technology would
be best suitable?. Enterprise Services COM+ components or .NET remoting or
Web Services? How can I take the decision? My application needs quick
response (Speed is important).
Thanks in advance.
Regards,
Risath
- 14
- Winforms >> Tab key in a datagrid on a modeless dialogHello
I have a datagrid on a modeless dialog and when the focus is on the datagrid
the tab key doesnt work. Now, I understand that when you have a modeless
dialog then there is some kind of message loop missing and that is why the
tab key doesnt get captured. That is why I though I could inherit my own
datagrid and override the ProcessKeyPreview to capture the Tab key. This
only works with the Enter key though. The Tab key never gets sent to the
DataGrid. Does anyone know where the tab goes? Do I have to use the textbox
column in some way to get hold of this one. I also wonder why the Enter key
is seen by the datagrid but not the Tab key.
Thanks for any input
/Peter
- 15
- Visual C#.Net >> trouble witch using struct from C dllHello, I'm a "expert of beginner" in C#.
I have a dll - in C. And in this dll is this struct:
typedef
struct msg_s { /* please make duplicates of strings before next call
to emi_read() ! */
int op_type; /* of "op_t" type: operation type; submit (>0), response
(<0) */
union {
struct {
const char* from;
const char* to;
const char* notif_addr;
int notif_type; /* not_t */
const char* validity; /* DDMMYYHHmm */
const char* timestamp; /* DDMMYYHHmmss */
dst_t deliv_status;
int deliv_reasoncode;
const char* deliv_timestamp; /* DDMMYYHHmmss */
const char* text;
int priority;
int bit8; /* data coding scheme */
int numbits; /* number of bits in TD (text) if bit8=1 */
int msg_class;
int rpid; /* rpid == -1 => use RPID value "0000" */
/* rpid == 0 => do not use RPID value */
const char* xservices; /* extra services */
} submit;
struct {
int ack;
int errcode;
const char* sysmsg;
} response;
} uu;
} msg_t;
How can I use this struct in C#?
How can I make in C# the same code as is in C:
msg_t* msg = 0;
msg = emi_msg( emi); //emi_msg is a function whitch return a pointer
optyp = msg->op_type;
Thanks a lot
Pavel Spaleny
|
| Author |
Message |
Wex

|
Posted: Sun Nov 27 00:51:05 CST 2005 |
Top |
Visual C#.Net >> Create a string of n pixel width...
Since I have no control over a treeview's scroll bars (i'm drawing icons
and text to the right of the treenodes) I've decided to just add some
special text to the end of my tree node text which I will then strip out
when it comes to drawing the treenode into the treeview...
Anyway I know there is a way to get the pixel length of a string that
already exists, but is there a good way to create a string of characters
that are a certain length? Should I just have a function that loops
adding 'x' until it's a certain length? Since this will only be run
when a node is created or when a node's special properties change I'm
just planning on doing this - unless any of you know of a better solution.
Thanks,
Benny
DotNet243
|
| |
|
| |
 |
Reuben

|
Posted: Sun Nov 27 00:51:05 CST 2005 |
Top |
Visual C#.Net >> Create a string of n pixel width...
Some methods used for graphics/drawing automatically wrap text a new line
when given the bounds of the Text as a rectangle. I don't know if this is in
CLI but it is in the managed DirectX libraries, so you should be able to do
this somehow. By the way, you'll need a method to tell you the length of the
String with a specified Font- unless you're using a fixed-width font,
different characters will have different (visual) lengths.
|
| |
|
| |
 |
Benny

|
Posted: Mon Nov 28 11:04:34 CST 2005 |
Top |
Visual C#.Net >> Create a string of n pixel width...
Graphics.MeasureString( string text, Font font )
does the measuring of the string automatically for me... What I wanted
was to create a string that was x length automatically... What I ended
up doing was to loop adding a character to my string until MeasureString
returned a value >= the value I wanted. This seems to be working fine.
~Benny
--- Message from Reuben
>> Some methods used for graphics/drawing
>> automatically wrap text a new line
>> when given the bounds of the Text as a
>> rectangle. I don't know if this is in
>> CLI but it is in the managed DirectX
>> libraries, so you should be able to do
>> this somehow. By the way, you'll need a
>> method to tell you the length of the
>> String with a specified Font- unless
>> you're using a fixed-width font,
>> different characters will have different
>> (visual) lengths.
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Visual C#.Net |
- Next
- 1
- Dotnet >> Help with the magically instantiating collection classHi everyone,
I posted a question earlier about a collection class that I'd made seemingly
getting instantiated magically after a class that contained a variable of
that type had its constructor called.
The constructor didnt touch the collection class and defineately didn't
initialise it.
Some one suggested the following reason as what is happening.
If anyone can help with what I've said down below i'd be very greatful:
Thanks
> Field initialization
> The initial value of a field, whether it be a static field or an instance
> field, is the default value (§5.2) of the field's type. It is not possible
> to observe the value of a field before this default initialization has
> occurred, and a field is thus never "uninitialized".
I'm not really sure what to make of that. How come, if I dont initialise, by
means of a constructor, a string for example - its null until I give it
something?
Thanks
- 2
- Net Framework >> Debugging a server appHi,
I am having the following event logged when I try to debug a COM+ server
application:
"The server {54AD3709-9B43-42A8-B896-404FDCF4AC85} did not register with
DCOM within the required timeout"
I also get a dialog box saying "An error ocurre while processing the last
operation. Error code 8008005 - Server execution failed. The event log may
contain additional troubleshooting information".
And all I am doing is:
I go to the Component Services Explorer and I Start the COM+ application.
This opens an instance of VS.NET 2003 containing dllhost.exe.
My intention is to be able to debug the components in that COM+ server app.
--
Thanks in advance,
Juan Dent, M.Sc.
- 3
- Visual C#.Net >> OO AnalysisAlright, I've read Jesse Liberty's book almost cover to cover. So now I
know something about using C#. I have an idea for a program I want to
write.
I have NO IDEA what objects I need, or how to set things up. Are there
any good object-oriented books or website tutorials on ANALYSIS that you
would recommend? I need something that will teach me to diagram and
organize my thoughts.
The program I want to write transfers certain files and directories from
one PC to another. It seems I need a source computer object and a
destination computer object. Beyond that, to what level should I
extrapolate objects? Should I have a log object, for instance? Surely,
I wouldn't have an object for each program I want to copy (I was
thinking of doing an enumeration for software). I need to know where to
draw the lines.
-KV
- 4
- Visual C#.Net >> custom logging sink for logging application blockI have written a custom logging sink for the enterprise library logging
application block (June 2005). I have been able to configure it as expected
from the UI config tool (EntLibConfig.exe).
I have built a console application to test it with and I am getting the
following error message write to the default trace log when I attempt to use
my custom logging sink.
'An error occurred while the Distributor was processing the message. Please
check your configuration files for errors or typos. Verify that your sinks
are reachable (queues exist, permissions are set, database exists, etc...)'
This might be security related can anyone give me the answer on how to fix
this?
I can see from VS that the module for my custom logging sink is loaded at
runtime but I am unable to break into the assembly which indicates to me
that any of the 'LogSink' overridden methods are not being called.
Cheers
Ollie Riches
- 5
- Dotnet >> passing array f structuresI need help. I cannot find any documentation to inform me of what I need to
do. I have an array of structures of strings that I pass to unmanaged C code.
The C code popuates the array, but in the VB code I only get the
base,subcript 0, and the rest is gone. My question is, how do I pass and
return an arry of structures.
Does VB pass a pointer to a one-dimension array of pointers in such case?
help will be greatly appreciated
- 6
- 7
- Net Framework >> Compile warning???Hi
When i compile my app i get the following warning... not sure how to get rid
of it. I have removed and added my 'Reference' back in but it didn't change
anything.
Warning: The dependency 'MyDLL, Version=1.0.1672.16368, Culture=neutral' in
project 'MyApp' cannot be copied to the run directory because it would
overwrite the reference 'MyDLL, Version=1.0.1706.30700, Culture=neutral'.
Regards
Darryn
- 8
- Dotnet >> ClickOnce DeploymentWe are planning to use an executable along with Bootstrapper to handle
installation checks with ClickOnce. I dont see any option to specify the
install condition for the application that is deployed, even with the
bootstrapper I can just specify the install condition for the prerequisite
bundled along with the application getting deployed. So we have decided to
make a dummy installable and attach an external executable
(InstallConditionChecker) that could do the installation check and return the
appropriate exit code so that the installation can proceed / halt.
i understand there are some samples that talks about having a seperate
executable to do the install condition checks, but I dont get exactly how the
other executable is shipped to target machine
eg dotnetchk.exe that does the prerequisite check before installation of
dotnetframework
- 9
- ADO >> Batch Update ProblemHi,
I am porting an ADO.NET 1.1 project to version 2.0 and trying to take
advantage of the dataAdapter's UpdateBatchSize property. When I set this to
0 and change my updatedRowSource to either NONE or OUTPUT PARAMS, I get the
following error when trying to update more than one row.
5/10/2006 12:52:18 - Exception occurred ---> Description:
ExceptionHandling.CustomException: The ConnectionString property has not been
initialized. ---> System.InvalidOperationException: The ConnectionString
property has not been initialized.
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
My update method is as follows. I initialize the data adapter's update
related sql command objects' connections at run-time. (I am not using
'USING' as I want to catch exceptions)
Private Sub DoUpdate()
Dim cn As New SqlConnection(strConn)
Me.dataAdapter1UpdateCommand.Connection = cn
Me.dataAdapter1DeleteCommand.Connection = cn
Me.dataAdapter1InsertCommand.Connection = cn
Try
Me.dataAdapter1.Update(Me.Ds.dtMyTable)
Catch ex As Exception
LogExceptions(Me.Name, "DoUpdate", ex)
MessageBox.Show(strChgError, strSrvrError, MessageBoxButtons.OK,
MessageBoxIcon.Error)
Finally
cn.Dispose()
End Try
End Sub
Can anyone tell me why this happens and how to fix it. I can correct the
problem by setting the updateBatchSize to 1, and the problem does not occur
when only one row is being updated. I am connecting to SQL Server 2000 SP4.
Thanks.
--
John
- 10
- 11
- Dotnet >> Strange, intermittent "Configuration Error" involving a COM DLLI have a Dot Net project that references a COM DLL called
"Crypto.dll," which is registered on my machine. I added the reference
via the "Add Reference" dialog in Visual Studio Dot Net, and I am
successfully accessing methods in this DLL in some of my classes.
"Interop.CRYPTOLib" is the name of the interop VS.NET created for me
when I added the reference.
Frequently, when I try to run my application, I get the error that
follows.
What's very frustrating and puzzling is that sometimes this error
occurs and sometimes it doesn't; it will occur 10 times in a row, then
I'll walk away from my desk for 15 minutes, and the application will
run fine.
Rebootimg my machine always seems to fix the error, but only for a
short period of time; it always recurs eventually.
Any help that anyone could give me on this would be greatly
appreciated...I'm really stumped! Thanks in advance!!
--JB
---------------------------------------------------------
HERE IS THE ERROR:
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: Access is denied: 'Interop.CRYPTOLib'.
Source Error:
Line 196: <add assembly="System.EnterpriseServices,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
Line 197: <add assembly="System.Web.Mobile, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 198: <add assembly="*"/>
Line 199: </assemblies>
Line 200: </compilation>
Source File: c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config
Line: 198
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'Interop.CRYPTOLib' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Interop.CRYPTOLib
(Partial)
LOG: Appbase = file:///C:/Inetpub/wwwroot
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Interop.CRYPTOLib
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/8073f566/7100ac34/Interop.CRYPTOLib.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/8073f566/7100ac34/Interop.CRYPTOLib/Interop.CRYPTOLib.DLL.
LOG: Attempting download of new URL
file:///C:/Inetpub/wwwroot/bin/Interop.CRYPTOLib.DLL.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Interop.CRYPTOLib, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573
- 12
- 13
- 14
- Visual C#.Net >> No parameterless constructor defined for this object**************************************
//Load the Assembly
Assembly a = Assembly.LoadFrom(sAssembly);
//Get Types so we can Identify the Interface.
Type[] mytypes = a.GetTypes();
BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public |
BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
//Iterate through the Assembly to find Class with a Public Interface.
//****Each Assembly should only have one Public Entry Point****
//****using this method to expose that method and pass the XML data to it****
foreach (Type t in mytypes)
{
MethodInfo[] mi = t.GetMethods(flags);
Object obj = Activator.CreateInstance(t);
**************************************
I am trying to dynamically call an assembly. The Assembly name is being
pulled from a SharePoint List and in this case it is called TransformXML. I
am getting the following error when it gets to the Activator...
ERROR:
**********************************************************
*An unhandled exception of type 'System.MissingMethodException' occurred in
* *mscorlib.dll
*
*
*
*Additional information: No parameterless constructor defined for this
object *
**********************************************************
I am also including the code from the class being called.
Transform.dll
**************************************************
public class CreateTransform
{
#region Public Methods
public CreateTransform()
{
}
public CreateTransform(string sXML, Microsoft.SharePoint.SPListItem
_spListItem)
{
//System.Xml.XmlDocument xmlDoc;
Microsoft.SharePoint.SPAttachmentCollection spAttachColl =
this.GetXSLTransform(_spListItem);
this.TransformXML(sXML,spAttachColl);
}
#endregion
- 15
- Dotnet >> help w/the line in Visual C++ 2005 ExpressVisual C++ 2005 Express
MVP's and experience programmer's only please!...
I need to get the number of lines in a textbox so I can insert them into a
listview. The text comes from my database and is unformatted. I display the
text to my user in the listview. The textbox I create logically in the
program, and I initialize the correct properties for a normal multiline
editor.
When the user changes the column size then I reload the lines accordinally.
The problem I am having is when I get the lines property which is a
array<^>^(). The lenght is always 1 no matter how many lines are in the
textbox.
In MFC when the lines are wraped the new line character is automattically
inserted, but here it's not.
Can you help me solve this problem? I would really appreciate it!
Thanks!...
--
Eric Miller
|
|
|