Posts Tagged ‘visual studio’

exception error in vb.net setup

Monday, August 23rd, 2010

when i install my vb.net project setup into another system ,( that system have no visual studio, crystal report 2008) shows  "type initializer for module 1 threw an exception"  error(in module 1 i declared Public cryRpt As New ReportDocument,  Public crtableLogoninfos As New TableLogOnInfos, Public crtableLogoninfos As New TableLogOnInfos,  Public crtableLogoninfos As New TableLogOnInfos,  Public crtableLogoninfo As New TableLogOnInfo,   Public crConnectionInfo As New ConnectionInfo,Public CrTables As Tables, Public reportpath As String = Application.StartupPath.ToString, Public str As String,   Public CrystalReportViewerObject As Object,  Public ReportName As String , Public rptp As String = "",   Public Reportformula As String)-anybody can help me please.

  my project is vb.net windows application,in visual studio 2008, reports are in crystal report 2008.the same setup is running in my pc without showing the error.

 

How to get Windows Mobile Device Center To Connect to the Emulator

Monday, August 23rd, 2010

I have recently installed Windows 7 and I have come to a conclusion. While Active Sync was old and did not work great, it did work. I could connect to my devices and emulators after the proper rituals and incantations.

The other conclusion I have come to is that Windows Mobile Device Center is worse that Active Sync was. I cannot get it to reliably connect to my emulator (yes, I have set the connection type to DMA) despite how many times I cradle and uncradle. (The emulator connects to the Visual Studio Debugger just fine though.)

With active sync I had to manually press the connect button in the connection settings after cradling the emulator. The biggest change I can see with Windows Mobile Device Center is that they removed that button.

Is there any way to get Active Sync to work on Windows 7 so I don’t have to deal with this? Or is there some way to get it to connect to Windows Mobile Device more reliably?

Visual Studio – Working on the same project via multiple machines

Monday, August 23rd, 2010

Hi,
I like to work between my laptop and desktop during different parts of the day.
I have recently installed VS 2010 Extreme and am wondering the best way to go about sharing a project across these two machines.
Whether to go with something like subversion, or whether to put the project on a network drive and open it on the current machine I am on.
Any thoughts or warnings from someone more experienced much appreciated.

DataSet changes not being persisted to database

Sunday, August 22nd, 2010

I have a windows form with a number of data-bound fields relating to a client. Additionally, I have a DataGridView showing orders for the currently displayed client. This is achieved using the design-time Visual Studio controls (e.g. a project DataSet, BindingSources TableAdapters and a TableAdapterManager.

When loading the form to edit an existing client it is populated using a (custom) FillByID method on the ClientsTableAdapter to filter the DataSet to the single, relevant client. This loads their details into the client fields, and populates the orders DataGridView correctly.

Any changes I make to a client’s orders (within the DataGridView) are persisted to the database when saving, however, none of the client detail fields are. They are editable, and show the correct details when loading, but no changes that are made are saved when the form is closed. I have tried two separate ways of persisting them now, the first being inline with the order saving:

this.Validate();
this.clientordersBindingSource.EndEdit();
this.clientsBindingSource.EndEdit();
this.clientordersTableAdapter.Update(projectDataSet.clientorders);
this.clientsTableAdapter.Update(projectDataSet.clients);

…and the second using the multiple table example on MSDN. Sadly, neither of these methods work with regards to the client details – although changes to client orders are persisted in both cases.

My clients table has the following structure:

refnumber, title, forename, surname, gender, dob, contactnumber

The clientsTableAdapter has the following CommandText strings for the DeleteCommand, InsertCommand, SelectCommand and UpdateCommand respectively:

DELETE FROM clients WHERE (refnumber = @Original_refnumber)
INSERT INTO clients (refnumber, title, forename, surname, gender, dob, contactnumber) VALUES (@refnumber, @title, @forename, @surname, @gender, @dob, @contactnumber)
SELECT refnumber, title, forename, surname, gender, dob, contactnumber FROM clients
UPDATE clients SET refnumber = @refnumber, title = @title, forename = @forename, surname = @surname, gender = @gender, dob = @dob, contactnumber = @contactnumber WHERE (refnumber = @Original_refnumber)

When saving, if I add a variable to capture the result of this line:

var res = this.clientsTableAdapter.Update(projectDataSet.clients);

projectDataSet.clients has a Count of 1, but res is 0.

Please can anyone offer any hints? This has been driving me insane for days!

Unable to copy file XXX. The process cannot access the file XXX because it is being used by another process…. ?

Sunday, August 22nd, 2010

My project include 2 main project

1. Dll
2. some GUI that testing the Dll

Everything was OK – until something happened ( i did not done anything on the project setting ) and now when i compile the GUI i get two error massage

Message 1
Unable to copy file “C:WorkspaceProjectsProjectNamebinDebugDllName.dll” to “binDebugDllName.dll”. The process cannot access the file ‘binDebugDllName.dll’ because it is being used by another process.

Message 2
Unable to copy file “C:WorkspaceProjectsProjectNamebinDebugDllName.pdb” to “binDebugDllName.pdb”. The process cannot access the file ‘binDebugDllName.pdb’ because it is being used by another process.

The project is not running and i try to remove the reference from the GUI to the DLL and define it again – but nothing help.
I also close the project thru the Visual studio and open it again – and its still does not compile.

( If i try to compile the DLL alone its compile fine )

How can i solve it ?
Why this happened without changing the project setting ?

Thanks.

Programming with N-tier

Sunday, August 22nd, 2010

What are the general guideline today for structuring a 3-tier application in Visual Studio 2010 with C#?

  1. Create blank Solution
  2. Create a class library to hold data sets
  3. Create a class library to hold data
    entity
  4. Create a class library to hold the
    business logic
  5. Create a class library to hold user
    interface (WPF or windows forms)

Is this correct?

Sync Framework 2.0 Error: The specified change tracking operation is not supported.

Sunday, August 22nd, 2010

I’m fairly new to the MS Sync framework and have been beating my head against the wall for about four hours now to no avail. I’m simply trying to sync my databases (one “master” SQL Server 2008 with a SQL Server CE, the client) with:

Dim syncAgent As DataCacheSyncAgent = New DataCacheSyncAgent()
Dim syncStats As Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()

It works just fine in Visual Studio 2010 and always manages to sync, but now that I’m trying to implement it on my client’s computers, I always get the error:

The specified change tracking operation is not supported. To carry out this operation on the table, disable the change tracking on the table, and enable the change tracking.

I’ve tried everything that I can think of to no avail, but like I said I’m new to the sync framework and haven’t found much help on Google. I’ve tried turning change tracking off and back on (on the server via SQL Mgmt Studio), but that didn’t work either. Perhaps it meant I should turn it off & back on in the client? How might I accomplish that programmaticly?

VS2008 post-build event batch file

Sunday, August 22nd, 2010

I’m trying to execute a batch file to move a bunch of files around after a build so I’ve created a post-build event that looks like this:

$(ProjectDir)CopyPlugins.bat $(ConfigurationName)

The problem is that when Visual Studio tries to run the event I get the error that the process exited with code 9009

The problem appears to be that VS puts the entire line in quotes so that the command it runs is:

"C:UserskdmurrayVisual Studio 2008ProjectsRunnerRunnerCopyPlugins.bat Debug"

Of course what I intended it to do was a very subtle variation, changing the location of the closing quotation mark.

"C:UserskdmurrayVisual Studio 2008ProjectsRunnerRunnerCopyPlugins.bat" Debug

Is there any way around this rather annoying “help” that VS provides?

C# – Pushing Enter in MessageBox triggers control KeyUp Event

Saturday, August 21st, 2010

System: Windows7 Pro, Visual Studio 2010, C#

I have a textbox: textBox1
I set its event:

textBox1.KeyUp += new KeyEventHandler(textBox1_KeyUp);

 private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                button1.PerformClick();
            }
        }

private void button1_Click(object sender, EventArgs e){
        if (string.IsNullOrEmpty(textBox1.Text))
                {
                    MessageBox.Show("Invalid data", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
}

It works fine, the problem is, when the data entered is invalid, and thus the MessageBox is shown, when i hit ENTER on the MessageBox OK Button, it also triggers the textBox1_KeyUp, which causes the MessageBox to show up again.

Thanks for your help.

Trying to Make the Simplest OpenID using DotNetOpenAuth Login in asp.net

Saturday, August 21st, 2010

I’ve downloaded the Visual Studio 2010 Template associated with the http://www.dotnetopenauth.net/. I can get that to work as advertised. I am not starting a project from scratch and I don’t want to put a lot of time into integrating all the web.config, handlers, etc. into my application to get OpenID working for me. The doc says that I should be able to make a one line implementation using a button and a user control. I believe I have done that and I get an error.

Here is what I’ve done.

  1. Create empty asp.net web project
  2. Add DotNetOpenAuth.dll to bin and reference it
  3. Add user control registration to top of page
  4. Create Button on page that calls user control.

When I run it and press the button, I get:

“Precondition failed: this.Identifier != null No identifier has been set.”

I know there must be more to it than this, but I just don’t get it. Can someone explain further what I need to do?

Thanks,

<%@ Page Language="C#" %>
<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty" TagPrefix="rp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void LoginId_Click(object sender, EventArgs e)
    {
        OpenIdTextBox1.LogOn();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:Button ID="LoginId" runat="server" Text="Button" onclick="LoginId_Click" />

      <rp:OpenIdTextBox ID="OpenIdTextBox1" runat="server" />

    </div>
    </form>
</body>
</html>