ChristianEhrlicher's Q&A profile
Visual Studio Tools for Office Using Performance Counter breaks Addressbook and other message windows
In order to optimise the perfomance/usability of our application we have recently introduced a cpu performance counter. Using this counter prevents some of Outlook's windows from displaying properly. The easiest steps to reproduce this error are as follows: Repro 1 - Add the following code to an Addin (perhaps in the event handler of a button): Dim mProcessorPerformance As New System.Diagnostics.PerformanceCounter mProcessorPerformance.CategoryName = "Processor" mProcessorPerformance.CounterName = "% Processor Time" mProcessorPerformance.InstanceName = "_Total" mProcessorPerformance.MachineName = My.Computer.Name MsgBox(mProcessorPerformance.NextValue) - Run the addin and before doi ...Show All
SQL Server Using dynamic paths in XQuery
Hello all, I'm trying to retrieve data from xml by using a variable for the path which will be set dynamically. Here's the code xml-1: <LOOKUP source=" /Catalog/Participant/@rating "> ... </LOOKUP> xml-2: <Catalog> <Participant rating="30"/> </Catalog> sql: declare @src varchar(100) set @src = @xmlNode.value('( LOOKUP/@source)[1]' , 'varchar(100)') select xml_data.value('sql:variable("@src")','int') from xmlTable I set the @src variable to the value of the source attribute from xml-1; that value is the path to the integer value in xml-2 stored in the xml_data column. The error I'm currently getting: Conversion failed when converting the nvarchar value '/ ...Show All
Visual Basic Unable to cast object of type 'System.TimeSpan' ...
Here's my code: Dim ts As New TimeSpan ts = TimeSpan.Parse("1:02:03") MsgBox(Format(ts, "HH:mm:ss")) I get this error message at the MsgBox line: Unable to cast object of type 'System.TimeSpan' to type 'System.IConvertible'. What's happening here I am running Visual Basic Express 2005. Version info: Microsoft Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200) Microsoft.NET(Framework) Version 2.0.50727 Microsoft Visual Basic 2005 76541-000-0000011-00124 ---------------- You could just use toString as in >> ts = TimeSpan.Parse( "01:02:03" ) MsgBox(ts.ToString) ------------------- True. But in my app I ...Show All
.NET Development returning fields from SWbemObject
Hi there, I am using WMI to send a WQL query to an SMS server and retrieve information on systems on our LAN. I am working on a .net application to display the results of these reports. I am able to return an SWbemObject with the results of the query. In order to access items in the object I use code like this: Dim objResultSet as SwbemObjectSet Dim objResultRow as SWbemObject < CODE THAT CONNECTS TO SERVER AND EXECUTES QUERY > For Each objResultRow In objResultSet objResultRow.SMS_G_SYSTEM_CDROM.DESCRIPTION Next The problem with this is that I want to be able to return the field value, without hardcoding the field name. something like dim fieldName as String fieldName = "SMS_G_SYSTEM_CDROM.DE ...Show All
SQL Server SQL Agent Roles
I have a domain account that is assigned the the SQLAgentOperator, SQLAgentReader, and SQLAgentUser roles. That domain account is able to create a job and delete the job. But, it is unable to edit the job. If I create a SQL Login with these same permissions, it is able to edit the job. What am I missing We were looking forward to implementing these new built-in security roles because we had to use our own security roles to give us similar functionality in SQL 2000 but it doesn't seem to be working properly in 2005. Michelle I added one of our SQLAgentOperatorRole domain accounts to the sysadmin server role and it does seem to have the sysadmin permissions (it can do anything to any job, r ...Show All
.NET Development Creating tables SMO
Is there an easy way to create an SMO.Table from a Data.DataTable, other than the brute force method Brute Force method might be like below: Public Function CreateTable( ByVal DBName As String , ByVal table As DataTable) Try Dim created As Boolean = False Dim tbl As Table Dim col As Column Me .DBConnection.Open() Me .Svr.ConnectionContext.Connect() tbl = New Table( Me .Svr.Databases(DBName), table.TableName) If Not tbl Is Nothing Then For Each adoCol As DataColumn In table.Rows col = Me .GetSmoCol(adoCol, tbl) tbl.Columns.Add(col) Next tbl.Create() End If Catch ex As Exception Throw Finally Me .Svr.ConnectionContext.D ...Show All
.NET Development Warning: There are updated custom wrappers available for the following referenved components: Office.
Hello everyone, I converted a vb.net 2002 project to vb.net 2005 and I continue to get the warning message: There are updated custom wrappers available for the following referenced components: Office . If I dbl-click on the message I get: One or more custom wrappers for COM components have been installed on your machine after you added references to those COM components. These wrappers may provide additional capabilities not offered by the auto-generated wrappers currently in use. Do you want to replace the auto-generated wrappers with the custom wrappers If I click YES then I get 102 ERRORS++. If I click NO then the project runs just fine but the warning shows in the IDE. Without turning ...Show All
Windows Forms How to use key Enter instead of Tab in DatagridView
By default, datagridview in Winform use Enter to move focus to next row(move to cell below the current cell) and Tab to move focus to next cell in the same row(but cannot move to row). How can I make all operations use the Enter key and the current cell will move in path like shape "Z" I have tried events of datagridview like KeyDown, CellValidating, CellValidated ..etc, but fail. Anyone can help Thanks. Alternatively you can also do this: creating custom grid with enter key : Public Class DGV Inherits DataGridView Private Const WM_KEYDOWN As Integer = &H100 Private Const WM_KEYUP As Integer = &H101 Private Const WM_CHAR As Integer = &H102 Public Ove ...Show All
Visual Basic how to detect parameter values passed to method
Hi, i want to log the method's name and the list of parameters along with there values. Retrieving the name of parameters and its position is easy, but can someone help me out How to retrieve the values of these parameters I don't want to add the parameter in a collection line by line. whenever an exception occurs, i do the following to get the name and type of the parameter., But my Question is "how to retrieve parameter values passed to the method" Dim paramInfo() As System.Reflection. ParameterInfo = ex.TargetSite. GetParameters( ) Dim i As Integer = 0 For i = 0 To paramInfo.Length - 1 Response.Write("Parameter " & i + 1 & " Name : " & paramInfo(i) .Name & "<br ...Show All
Visual Basic Event viewer not displayed in windows 2000 os
I want to create an event viewer for logging my errors. My development machine has windows xp and the production has windows 2000. On click of a button i have the following code.. If Not EventLog.SourceExists( "PayAtTheDoor" ) Then EventLog.CreateEventSource( "PayAtTheDoor" , "PayAtTheDoor" ) End If ' Create an EventLog instance and assign its source. Dim myLog As New EventLog() myLog.Source = "PayAtTheDoor" ' Write an informational entry to the event log. myLog.WriteEntry( "Error in Receive Function." ) It works fine and i see the event log creataed in my dev machine. But it does not create an event log in my production machine. Does the m ...Show All
Visual C# Problem with my Insert command
Hello Everyone, I am trying to write an insert command in my code with in a while loop. The insert should take different values everytime it goes through the loop. I have this so far: -------Start Code---- // Connect to a Microsoft Access database using the // System.Data.OleDb.OleDbConnection class string strOleDb; strOleDb = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + myPath; OleDbConnection cn = new OleDbConnection(strOleDb); OleDbCommand myCom = new OleDbCommand(); myCom.Connection = cn; i=0; cn.Open(); while (i < 3) { tmpString = "test1"; tmpAnnot = "test2"; myCom.CommandText = "Insert Into test (test, testdata, id)" + " v ...Show All
SQL Server I HTTP access to SQL SERVER 2005 AS on Microsoft Windows XP
Hi all, I have configured an HTTP access to SQL SERVER 2005 Analysis Services on Microsoft Windows XP followinf the tutorial on http://www.microsoft.com/technet/prodtechnol/sql/2005/httpssas.mspx I configured the security settings of my virtual directory (authentication method) to anonnymous access. When I access the Analysis Server 2005 through a URL http://systems/olap/msmdpump.dll as a server name I get an error message on the webbrowser as HTTP 500 - Internal server error Internet Explorer . Could some help me since I am handing in my academic project very soon. Thanx in advance Ronald Hello Ronald. have you tried the tips provided by Edward in his blog http://www.sqljunkies.com/WebLog/ed ...Show All
Visual Basic Report Question
In one table there layout is as below. FolderNum FirstName LastName PrimaryB Party Type 06-000001 John Smith -1 B I (Primary Buyer) 06-000001 Jane Smith 0 B I (Spouse) The -1 means they are the primary buyer, the 0 means they are the spouse. On a report, how can I get these fields to show up as: Not worried about the color (label) Primary First Name: John Last Name: Smith (label) Other First Name: Jane Last Name: Smith i would use a case statement in the SQL (CASE WHEN PrimaryB = -1 THEN 'Primary' ELSE 'Other' END) as 'some label name' ...Show All
Visual Studio Express Editions StreamWriter
I've got StreamWriter to add stuff to a textfile, but I'm now wondering how to delete a whole line in the textfile so it doesn't leave a empty line in the textfile. Code that doesn't work Dim objStreamWriter As IO.StreamWriter objStreamWriter = New IO.StreamWriter( "C:\Test.txt" ) objStreamWriter.WriteLine( "" ) objStreamWriter.Close() No, it doesnt answer the original posters message but I'm not writing a CR/LF line and can simplify the code completely. The code they have provided appears to simply write a blank file and takes 4 lines to achieve it. When it can be simplified to 1. ...Show All
Visual Studio 2008 (Pre-release) TreeView & HierarchicalDataTemplate
Hi, I am using HierarchicalDataTemplate to bind my TreeView to list a set of directories. In our applicatoin, we have a favorites menu, from which user can navigate directly to a particular node in the tree. I got the logic to get the active item. But I couldn't set it to the SelectedItem or SelectedValue of the TreeView as they are readonly properties. Is there a way to hack this or this is not possible in WPF with HierarchicalDataTemplate. Please help me, this is blocking me to go further. Thanks, -------------------------------- Raghavendra RAV After successfully expand the node and select it, I believe you also wanna bring it into the view, you can do so by using TreeViewItem.BringIntoView(). Sheva ...Show All
