Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Goon Matchmaker
Oct 23, 2003

I play too much EVE-Online

Darn Cotts posted:

Oh please someone help me before I go completely insane!

Page_Load seemed an okay choice, so I checked IsPostBack in there and if it was true then I send the request off to the web service. This seemed to work nicely, until I added a custom server-side validation control, which then wouldn't work at all. Having read up on the typical page lifetime, I get the impression that Page_Load isn't the right place to put my code that runs in response to the form being submitted. But I'm completely out of ideas as to where else to put it.

Can anyone point me in the right direction?
Double click on the submit button and the IDE should create an appropriate on_click() (I think its on_click() anyways the IDE will handle it assuming you're using visual web developer/visual studio 2005/.NET) event that will handle the button being pressed. Put your validation code in that. You can also throw in a Response.Redirect() (check msdn for syntax) and have it redirect the user to an appropriate page upon validation.

Adbot
ADBOT LOVES YOU

wwb
Aug 17, 2004

What Safrax said. Only other note is that you should always wrap the action code in a if (IsValid) statement to back up client-side validation.

Darn Cotts
Mar 12, 2004

\Job"ber*nowl`\, n. [OE. jobbernoule, fr. jobarde a stupid fellow; cf. E. noll.] A blockhead. [Colloq. & Obs.]
Ah ha, cheers guys :)

SpaceWokker
Jan 28, 2006
...but what is a space wok?
Does anyone know how to generate custom labels for data bound ASP.NET FormView controls?

code:
	<asp:FormView ID="FormView1" runat="server" DataKeyNames="CustNo" DataSourceID="ObjectDataSource1">
		<EditItemTemplate>
			StoreNum:
			<asp:TextBox ID="StoreNumTextBox" runat="server" Text='<%# Bind("StoreNum") %>'>
			</asp:TextBox><br />
			ShipTo:
			<asp:TextBox ID="ShipToTextBox" runat="server" Text='<%# Bind("ShipTo") %>'>
			</asp:TextBox><br />
			BillTo:
			<asp:TextBox ID="BillToTextBox" runat="server" Text='<%# Bind("BillTo") %>'>
			</asp:TextBox><br />
			[...]
I have quite a few tables I'm dealing with and it would be really nice if I could get it to generate nicer labels(in this case just text literals) for the controls. For example, I'd like it to display "Store Number, Ship To Store Id, and Bill To Store Id" rather than "StoreNum, ShipTo, and BillTo." Editing every single one by hand is a real burden. I'm searching all over but I can't find anything.

Celebrity Toaster
Jan 21, 2007

Don't worry boys, I'm on the guest list

Celebrity Toaster posted:

I'm trying to set the text of a listview sub item, but it doesn't appear to be playing ball :( I currently have the code

foreach (sensibleField field in selectedList)
{
string msgstring = recordBuffer.Substring(field.Offset, field.Size);

listView1.Items[j].SubItems[1].Text = "!!!!";

j++;
}

I can get the existing text out of the cell, but on any subitem other than the one at index 0 it refuses to set the text, what am I missing here?

bump! I'm back at work after a week off and still can't fix this drat problem. The subitem.text property is getting set fine, i have attached an event to the mousedown of the list view that will pop up a message box containing the current text of the clicked subitem. Clicking a subItem displays the desired text in the message box, but not in the listview. Any ideas? This is driving me insane :gonk:

binary_hero
Oct 10, 2004

by Lowtax

Celebrity Toaster posted:

bump! I'm back at work after a week off and still can't fix this drat problem. The subitem.text property is getting set fine, i have attached an event to the mousedown of the list view that will pop up a message box containing the current text of the clicked subitem. Clicking a subItem displays the desired text in the message box, but not in the listview. Any ideas? This is driving me insane :gonk:

Stupid questions:
1. How many columns do you have?
2. Can you write a piece of code, triggered on a button that does
code:
listView1.Items[0].SubItems[1].Text = "Hello, world"
and nothing else?
3. Is there any other code that could potentially be changing the data in the listview? Have you tried a new project, just a listview and a button?
4. The listview is in Details mode, right?
5. This code isn't in some larger Try/Catch block, and you are just missing an exception being thrown is it?
6. j does start at 0, right?
7. Is column 1 visible? You don't have a phantom column or something?

binary_hero fucked around with this message at 17:42 on Mar 12, 2007

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
Have you tried using RedrawItems(0,j,false) instead of Invalidate and Redraw?

wwb
Aug 17, 2004

SpaceWokker posted:

Does anyone know how to generate custom labels for data bound ASP.NET FormView controls?

code:
	<asp:FormView ID="FormView1" runat="server" DataKeyNames="CustNo" DataSourceID="ObjectDataSource1">
		<EditItemTemplate>
			StoreNum:
			<asp:TextBox ID="StoreNumTextBox" runat="server" Text='<%# Bind("StoreNum") %>'>
			</asp:TextBox><br />
			ShipTo:
			<asp:TextBox ID="ShipToTextBox" runat="server" Text='<%# Bind("ShipTo") %>'>
			</asp:TextBox><br />
			BillTo:
			<asp:TextBox ID="BillToTextBox" runat="server" Text='<%# Bind("BillTo") %>'>
			</asp:TextBox><br />
			[...]
I have quite a few tables I'm dealing with and it would be really nice if I could get it to generate nicer labels(in this case just text literals) for the controls. For example, I'd like it to display "Store Number, Ship To Store Id, and Bill To Store Id" rather than "StoreNum, ShipTo, and BillTo." Editing every single one by hand is a real burden. I'm searching all over but I can't find anything.

Don't quote me on this, but I suspect if one set the meta data correctly in Sql Server (or the correct attributes in your Object Data Source) then the *view controls would pick it up.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



I'm trying to run unit tests through TestDriven.Net, but I'm getting a really weird error back from TestDriven:

code:
------ Test started: Assembly: Project.UnitTests.dll ------

TestCase 'T:Project.UnitTests.Collections.ReadWriteTestCollection<T>'
failed: Couldn't find type with name 'Project.UnitTests.Collections.ReadWriteTestCollection<T>'
	System.ApplicationException: Couldn't find type with name 'Project.UnitTests.Collections.ReadWriteTestCollection<T>'
	at MutantDesign.Xml.Documentation.MemberInfoUtilities.FindMemberInfo(Assembly assembly, String xmlName)
	at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
	at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()
That class is right at the top of the file I'm running the unit tests out of:

code:
namespace Project.UnitTests.Collections
{
    public class ReadWriteTestCollection<T> : CollectionBase<T>
    {
...
I can't find any way around this error. Does anyone have some expierience with this problem?

Inquisitus
Aug 4, 2006

I have a large barge with a radio antenna on it.
I'm writing a custom control that's derived from TextBox, and I want to select all the text in it when the control gains focus. I thought this would be pretty simple to do; just override OnGotFocus and add SelectAll(); to it. This works when using tab to focus on it, but when using the mouse, it does nothing.

Any ideas?

waffle iron
Jan 16, 2004

Inquisitus posted:

I'm writing a custom control that's derived from TextBox, and I want to select all the text in it when the control gains focus. I thought this would be pretty simple to do; just override OnGotFocus and add SelectAll(); to it. This works when using tab to focus on it, but when using the mouse, it does nothing.

Any ideas?
I would try doing the same with OnClick and OnCursorChanged.

Inquisitus
Aug 4, 2006

I have a large barge with a radio antenna on it.
Thank you, good sir :)

MrBishop
Sep 30, 2006

I see what you did there...

Soiled Meat
I have a general "moving from WinForms to WebForms" question. I use business objects extensively in my c# apps, and was hoping to reuse as much of those objects as possible in ASP. I'm wondering, what's the smoothest way to reuse my BO's? Write a wrapper for each one, with an interface supported by ObjectDataSource? Or is there a shortcut?

For a bit of background, all of my custom collections inherit from BindingSource, and likewise all my individual "entities" inherit from a common source. The problem is that they all generated by a Factory, including the collections.

How do you handle this?

wwb
Aug 17, 2004

First, you don't have to use object data source to do stuff using ASP.NET. Old fashioned databinding works just fine with the new controls and really can be your only viable option depending on how your objects behave.

If you really must use object data source, then you will probably want to extend the object data source to embrace your framework by overriding the appropriate events.

Qaz Kwaz
Jul 24, 2003
What's your email? I've got some shitty posts that you NEED to read.

Darn Cotts posted:

Oh please someone help me before I go completely insane!

I'm quite familiar with .Net and C# in general, but I've never used ASP.Net before and I'm completely overwhelmed by it. I've Googled endlessly for stuff, but I can't find anything that answers some really basic questions I have about what's going on and how you're supposed to make pages in ASP.Net.


Not sure what these other guys used, but when learning ASP.Net I found the Wrox Professional ASP.Net 2.0 book to be very solid. You should give it a look.

Angry Midget
Jun 1, 2006
Here in hicksville.. err oops, I mean Sunbury, we don't have credit cards. Thanks bog!
sorry wrong place to ask my qestion

Angry Midget fucked around with this message at 09:29 on Mar 20, 2007

poopiehead
Oct 6, 2004

Qaz Kwaz posted:

Not sure what these other guys used, but when learning ASP.Net I found the Wrox Professional ASP.Net 2.0 book to be very solid. You should give it a look.

That book was very helpful to me when I had to learn ASP .NET. It's not perfect, but it's pretty drat good.

As far as data binding goes, as someone said above, in almost every case, I've gotten by with just assigning a collection of my business objects to the datasource property of the databound control.

wwb
Aug 17, 2004

^^^See, I am not alone.

I forgot to mention that, under the hood, this is pretty much what ObjectDataSource is doing. It just exists to make you write less UI code if you are willing to water things down to it's level.

ora_ocp
Feb 9, 2007
DBA'in ain't easy
I am having a problem formatting a datagrid programatically. I have created a Pocket PC application using the .NET compact framework. I have a web service that calls a stored procedure in an Oracle database and returns a dataset. I have been able to populate my datagrid with the two columns from the data set. However I want to be able to adjust the width of the columns in the datagrid, and change the column headers. The columns in the dataset are LOT_NUMBER, and SPECS

Here is my code:

HeatNumber = tbHeatNum.Text;

Service FindSlabs = new Service();
DataSet Slabs = new DataSet();

//Fills the dataset from a web service calling a stored proc.

Slabs = FindSlabs.GetHeatSlabs(HeatNumber);

//dgSlabs is the name of my datagrid

dgSlabs.DataSource = Slabs.Tables[0];

DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "dgSlabs";

// Slab Id column

DataGridColumnStyle SlabNum = new DataGridTextBoxColumn();
SlabNum.MappingName = "LOT_NUMBER";
SlabNum.HeaderText = "Slab";
SlabNum.Width = 200;
ts.GridColumnStyles.Add(SlabNum);

DataGridColumnStyle specs = new DataGridTextBoxColumn();
specs.MappingName = "SPECS";
specs.HeaderText = "Size";
specs.Width = this.Width - SlabNum.Width - 37;
ts.GridColumnStyles.Add(specs);


dgSlabs.TableStyles.Add(ts);

I am not sure what to enter for the MappingName of the DataGridTableStyle. I'm a .Net noob, so any advice would be greatly appreciated.

Darn Cotts
Mar 12, 2004

\Job"ber*nowl`\, n. [OE. jobbernoule, fr. jobarde a stupid fellow; cf. E. noll.] A blockhead. [Colloq. & Obs.]
Back again for my weekly DataGridView problem that nobody will reply to. :sigh:

I have a DataSet containing some data and a BindingSource object that is bound to a particular table in the DataSet. Then I have two DataGridViews on different tab pages that should both display the data from the DataSet, via the BindingSource. I set the DataSource and DataMember properties of the BindingSource to correspond to the table in the DataSet, and I set the DataSource property of both the DataGridViews to be the BindingSource. Then, at some later point in time, the DataSet is populated with data by another thread and when that's complete I call Refresh on all the DataGridViews.

The problem I'm having is that only the first grid that was bound is updating to show the rows that get added. I've tried checking the number of rows in the BindingSource just before the second grid refreshes, and it's correct, but the rows just aren't appearing there.

Any ideas?

edit: Solved! Needed to call ResetBindings on the BindingSource.

Darn Cotts fucked around with this message at 16:48 on Mar 20, 2007

Celebrity Toaster
Jan 21, 2007

Don't worry boys, I'm on the guest list

binary_hero posted:

Stupid questions:
1. How many columns do you have?
2. Can you write a piece of code, triggered on a button that does
code:
listView1.Items[0].SubItems[1].Text = "Hello, world"
and nothing else?
3. Is there any other code that could potentially be changing the data in the listview? Have you tried a new project, just a listview and a button?
4. The listview is in Details mode, right?
5. This code isn't in some larger Try/Catch block, and you are just missing an exception being thrown is it?
6. j does start at 0, right?
7. Is column 1 visible? You don't have a phantom column or something?

I managed to "fix" the problem, by setting the first column's text equal to itself again whenever I adjusted a different cells value. This was the only way I could seem to trigger the control to update. I'm still perplexed as to why it happened in the first place.

Daddy Fantastic
Jun 22, 2002

For the glory of FYAD
Does anyone know a good way to map a network share through .NET, other than launching net use in a new process?

Ethangar
Oct 8, 2002

My friend/coworker was telling me about a plugin for Visual Studio that tells me what code has been covered by NUnit and somehow highlights code that hasn't. But, he is out sick today, and I don't know the name of it. Does anyone know what he might be talking about?

ljw1004
Jan 18, 2005

rum

Ethangar posted:

My friend/coworker was telling me about a plugin for Visual Studio that tells me what code has been covered by NUnit and somehow highlights code that hasn't. But, he is out sick today, and I don't know the name of it. Does anyone know what he might be talking about?

"How to: Obtain Code Coverage Information"
http://msdn2.microsoft.com/en-us/library/ms182496(VS.80).aspx

In the end it generates a .cov file. You open this file in VS and it colours your source code red or green or whatever.

(PS. I've never used it myself! a colleague demonstrated bits of it to me yesterday.)

wwb
Aug 17, 2004

I think he is actually looking for NCover, which is pretty drat sweet.

Belgarath
Feb 21, 2003
How can you detect if a control has finished being loaded? There is an event that occurs both when the control is initially loaded, as well as when the user interacts with the control, and I only want to respond to the event on user interaction.

There doesn't seem to be a bool that indicates this, and google isn't being very helpful.

csammis
Aug 26, 2003

Mental Institution

Belgarath posted:

How can you detect if a control has finished being loaded? There is an event that occurs both when the control is initially loaded, as well as when the user interacts with the control, and I only want to respond to the event on user interaction.

There doesn't seem to be a bool that indicates this, and google isn't being very helpful.

I don't understand what you're asking here. What event are you talking about? There are a lot of events that occur when the user interacts with the control...MouseDown/Up, MouseEnter/Exit, Got/LostFocus, In/Validate, KeyUp/Down to name a few. What are you trying to accomplish?

Goonamatic
Sep 17, 2005
cunning linguist

Daddy Fantastic posted:

Does anyone know a good way to map a network share through .NET, other than launching net use in a new process?

Here you go

code:

 public class NetworkResource
    {
        // Win32 declarations (constants, enumerations, functions etc.)

        // Constants (integers)

        // Scope of the network resource enumeration
        private const int RESOURCE_CONNECTED = 0x00000001;
        private const int RESOURCE_GLOBALNET = 0x00000002;
        private const int RESOURCE_REMEMBERED = 0x00000003;

        // Set of bit flags identifying the type of network resource
        private const int RESOURCETYPE_ANY = 0x00000000;
        private const int RESOURCETYPE_DISK = 0x00000001;
        private const int RESOURCETYPE_PRINT = 0x00000002;

        // Display options for the network object in a network browsing user interface
        private const int RESOURCEDISPLAYTYPE_GENERIC = 0x00000000;
        private const int RESOURCEDISPLAYTYPE_DOMAIN = 0x00000001;
        private const int RESOURCEDISPLAYTYPE_SERVER = 0x00000002;
        private const int RESOURCEDISPLAYTYPE_SHARE = 0x00000003;

        // Set of bit flags describing how the resource can be used
        private const int RESOURCEUSAGE_CONNECTABLE = 0x00000001;
        private const int RESOURCEUSAGE_CONTAINER = 0x00000002;

        // Connection options
        private const int CONNECT_UPDATE_PROFILE = 0x00000001;
        private const int CONNECT_INTERACTIVE = 0x00000008;
        private const int CONNECT_PROMPT = 0x00000010;
        private const int CONNECT_REDIRECT = 0x00000080;
        private const int CONNECT_COMMANDLINE = 0x00000800;
        private const int CONNECT_CMD_SAVECRED = 0x00001000;

        // Structures

        [StructLayout(LayoutKind.Sequential)]
        private struct NETRESOURCE
        {
            public int dwScope;
            public int dwType;
            public int dwDisplayType;
            public int dwUsage;
            [MarshalAs(UnmanagedType.LPTStr)]
            public string lpLocalName;
            [MarshalAs(UnmanagedType.LPTStr)]
            public string lpRemoteName;
            [MarshalAs(UnmanagedType.LPTStr)]
            public string lpComment;
            [MarshalAs(UnmanagedType.LPTStr)]
            public string lpProvider;
        }

        // Win32 function declarations

        [DllImport("mpr.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
        private static extern int WNetAddConnection2(
            [MarshalAs(UnmanagedType.LPArray)]
			NETRESOURCE[] lpNetResource,
            [MarshalAs(UnmanagedType.LPTStr)]
			string lpPassword,
            [MarshalAs(UnmanagedType.LPTStr)]
			string lpUsername,
            int dwFlags
            );

        [DllImport("mpr.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
        private static extern int WNetCancelConnection2(
            [MarshalAs(UnmanagedType.LPTStr)]
			string lpName,
            int dwFlags,
            int fForce
            );

        /// <summary>
        /// Calls the Win32 function WNetAddConnection2 to connect to a network resource.
        /// </summary>
        /// <param name="share">A network share like "\\lonsfile05\users_m-r$\Chris.McKelt".</param>
        /// <param name="user">A user, such as "EMEA\Chris.McKelt".</param>
        /// <param name="password">A user's password.</param>
        /// <param name="drive">A network drive like "X:".  Set to an empty string, "", if no drive is to be mapped.</param>
        /// <author>Chris McKelt</author>
        /// <created>18/01/2005</created>
        public void Connect(string share, string user, string password, string drive)
        {
            NETRESOURCE[] nr = new NETRESOURCE[1];

            nr[0].lpRemoteName = share;
            nr[0].lpLocalName = drive;
            nr[0].dwType = RESOURCETYPE_DISK;
            nr[0].dwDisplayType = RESOURCEDISPLAYTYPE_GENERIC;
            nr[0].dwScope = 0;
            nr[0].dwUsage = 0;
            nr[0].lpComment = string.Empty;
            nr[0].lpProvider = string.Empty;

            int err = WNetAddConnection2(nr, password, user, 0);

            if (err != 0 && err != 85)	// 85 = Connection already exists
                throw new Exception("Unable to connect to " + share + ".  Error = " + err.ToString());
        }

        /// <summary>
        /// Calls the Win32 function WNetCancelConnection2 to disconnect a network resource.
        /// </summary>
        /// <param name="resource">The name of either the local name or the remote network resource to disconnect. 
        /// If a mapped drive is to be disconnected, pass a string like "X:".</param>
        /// <author>Chris McKelt</author>
        /// <created>18/01/2005</created>
        public void Disconnect(string resource)
        {
            int err = WNetCancelConnection2(resource, 0, 1);
            if ((err != 0) && (err != 2250)) // 2250 = connection does not exist
                throw new Exception("Unable to disconnect from " + resource + ".  Error=" + err.ToString());
        }
    }

Belgarath
Feb 21, 2003

csammis posted:

I don't understand what you're asking here. What event are you talking about? There are a lot of events that occur when the user interacts with the control...MouseDown/Up, MouseEnter/Exit, Got/LostFocus, In/Validate, KeyUp/Down to name a few. What are you trying to accomplish?

Ok, I guess I wasn't very specific, I apologise. Here goes:

I'm coding in c#, and I'm using a DataGridView, and I'm interested in the RowEnter event. MSDN says that "This event occurs when the DataGridView is initially loaded, as well as when the user selects a row other than the current row."

I only want to respond to the event when the user selects a row other than the current row, not when the control is initially loaded.

Daddy Fantastic
Jun 22, 2002

For the glory of FYAD

Goonamatic posted:

Here you go
That looks great; thanks! I'll try it out on monday.

poopiehead
Oct 6, 2004

Belgarath posted:

Ok, I guess I wasn't very specific, I apologise. Here goes:

I'm coding in c#, and I'm using a DataGridView, and I'm interested in the RowEnter event. MSDN says that "This event occurs when the DataGridView is initially loaded, as well as when the user selects a row other than the current row."

I only want to respond to the event when the user selects a row other than the current row, not when the control is initially loaded.

I don't use that control very much, so there probably is a better way to do this, but....

You could have a member variable int that is the numer of rows and decrement it in the rowEnter event. When it reaches zero, you know that it's done loading.

Alternately I don't know if the RowLeave event gets called on load, but if it doesn't, you can use a bool member variable that you set to true on RowLeave. A row would have to be left before another can be entered.

epswing
Nov 4, 2003

Soiled Meat
Ok this is really blowing my mind. VB.NET.

code:
    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim conn As OdbcConnection
        Dim cmd As OdbcCommand
        Dim sql As String
        Dim rdr As OdbcDataReader

        Dim connString As String = _
    "Driver={Microsoft Access Driver (*.mdb)};" & _
    "Dbq=db1.mdb;pwd=mypass"
        conn = New Odbc.OdbcConnection(connString)
        conn.Open()

        sql = "SELECT * FROM t"
        cmd = New OdbcCommand(sql, conn)
        rdr = cmd.ExecuteReader()
        While (rdr.Read())
            MsgBox(rdr.GetValue(0).ToString() & " " & rdr.GetValue(1).ToString())
        End While

        conn.Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim conn As OdbcConnection
        Dim cmd As OdbcCommand
        Dim sql As String

        Dim connString As String = _
    "Driver={Microsoft Access Driver (*.mdb)};" & _
    "Dbq=db1.mdb;pwd=mypass"
        conn = New Odbc.OdbcConnection(connString)
        conn.Open()

        sql = "INSERT INTO t(col1, col2) VALUES ('hi', 'there')"
        cmd = New OdbcCommand(sql, conn)
        MsgBox(cmd.ExecuteNonQuery())

        conn.Close()
    End Sub
Here are two subroutines attached to two buttons. The first selects * from t and prints the first two columns with a space in between. The second inserts 'hi' into the first column and 'there' into the second column.

I run the program, click the first button. I get nothing as expected. Click the second button, and a msgbox with "1" comes up (so 1 row affected). I click it again, and again, 1 row affected. I click the first button and I get two consecutive msgboxes, both with "hi there". Great!

I go look at the access mdb file...no rows have been added. I close the program, run it again, click the first button. Nothing.

The inserts make it into the database, I can select them out, but it's like they're not REALLY there. Or something. I'm really confused.

epswing
Nov 4, 2003

Soiled Meat
Ok after more than an hour, I finally got it. VS dumps all your resources to a ./bin/Debug subdirectory, INCLUDING THE LOCAL DATABASE you may be operating on. That's why there was always a fresh copy of the db when I started the program.

Unbelievable.

Belgarath
Feb 21, 2003
poopiehead: I'd not thought of trying that, I've been looking for a neat '.net way' to do it. Thanks.

epswing posted:

Ok after more than an hour, I finally got it. VS dumps all your resources to a ./bin/Debug subdirectory, INCLUDING THE LOCAL DATABASE you may be operating on. That's why there was always a fresh copy of the db when I started the program.

Unbelievable.

In the solution explorer, if you right click the local database you are working with (I assume an Access db), and click 'Properties', you can get VS to stop copying it every time, there are 3 options: Do not copy, Copy always and Copy if newer.

This is true for any file e.g. pictures, sound files etc (I believe).

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Ethangar posted:

My friend/coworker was telling me about a plugin for Visual Studio that tells me what code has been covered by NUnit and somehow highlights code that hasn't. But, he is out sick today, and I don't know the name of it. Does anyone know what he might be talking about?

Sounds like http://www.testdriven.net/

Ethangar
Oct 8, 2002

Munkeymon posted:

Sounds like http://www.testdriven.net/

Yeah, I already had that to run NUnit from Visual Studio. I totally missed the coverage part of it.

Yaksha
Jun 28, 2005

Demilich
I have an ASP.NET application that runs off of an Access database (I know, I know, but I can't change it now).

I'm looking for an Access db/table editor in ASP.NET. The feature I really need is a way to create new tables via GUI and it needs to be able to allow me to set the "Allow Zero Length" parameter (or at least default to "Yes").

Anyone know where I can find one?

Hey!
Feb 27, 2001

MORE MONEY = BETTER THAN
I built a Windows service for a customer. The service is taking 99% CPU on the machine they have it installed on, however, I didn't write any busy waiting, nor any for loops that could degenerate into an infinite loop. Most of the time, the service should just be listening to a socket waiting for network input, so it should hardly be using any CPU at all. I thought that maybe somewhere in one of the Framework methods it's doing some busy waiting, but how would I go about confirming that?

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Hey! posted:

how would I go about confirming that?

When I want to know what the framework is doing, I use the reflector. It's not really an optimal solution for the problem, but has solved several mysteries for me.

Adbot
ADBOT LOVES YOU

wwb
Aug 17, 2004

Hey! posted:

I built a Windows service for a customer. The service is taking 99% CPU on the machine they have it installed on, however, I didn't write any busy waiting, nor any for loops that could degenerate into an infinite loop. Most of the time, the service should just be listening to a socket waiting for network input, so it should hardly be using any CPU at all. I thought that maybe somewhere in one of the Framework methods it's doing some busy waiting, but how would I go about confirming that?

Get some trace utilities, such as JetBrains DotTrace. It will tell you where things are hanging.

  • Locked thread