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
Dromio
Oct 16, 2002
Sleeper
I'm diving into ASP.NET Ajax, but I'm having a hell of a time doing something more than just an Updatpanel and timer :)

I've got a page with a textbox. I've connected an AutoCompleteExtender to the textbox and want it to automatically fire a method on my page to update a gridview. It's like a filter-as-you-type sort of box. To make it even more tricky, the textbox and it's extender are both being dynamically generated.

Here's some code:
code:
AjaxControlToolkit.AutoCompleteExtender Extender = new AjaxControlToolkit.AutoCompleteExtender();
            Extender.ID = Filter + "Extender";
            Extender.TargetControlID = ColumnText.ID;
            Extender.ServiceMethod = "ColumnText_TextChanged";
            //Extender.ServicePath = Request.Url.ToString();
            Extender.MinimumPrefixLength = 2;
            Extender.CompletionInterval = 1000;
            Extender.ContextKey = Filter;
            FilterList.Controls.Add(Extender);
When i accidently set the servicePath, it did try to load the page. I saw that was the wrong thing to do, so I commented it back out. But at least I saw that the Extender was being triggered.

My ServiceMethod is something like this (just for testing):
code:
    [System.Web.Services.WebMethod, System.Web.Script.Services.ScriptMethod]
    public string[] ColumnText_TextChanged(string prefixText, int count, string BoxName)
    {
        return new string[] { "First", "Second" };
    }
It never gets called. The cursor flashes for a second when the script fires off, but I never see the results on my dropdown and any breakpoints never get hit.

I planned to have this method actually update the grid and just return an empty string array. Am I barking up the wrong tree here?

Adbot
ADBOT LOVES YOU

MillDaKill
Aug 19, 2003

How could you Carl?
I am trying to make a program in VB.net 2003 that will email out some files. From my reading I am looking for the class system.web.mail but my install does not seem to have it. I am using .net framework 1.1 sp1.



I am very new to VB.net and this is about the 3rd application I have created.

Richard Noggin
Jun 6, 2005
Redneck By Default

MillDaKill posted:

I am trying to make a program in VB.net 2003 that will email out some files. From my reading I am looking for the class system.web.mail but my install does not seem to have it. I am using .net framework 1.1 sp1.



I am very new to VB.net and this is about the 3rd application I have created.

Are you sure you're using the .NET Framework 1.1? System.Web.Mail was changed to System.Net.Mail in .NET 2.0, and generates a compiler warning ("obsolete") in .NET 3.0.

SLOSifl
Aug 10, 2002


Richard Noggin posted:

Are you sure you're using the .NET Framework 1.1? System.Web.Mail was changed to System.Net.Mail in .NET 2.0, and generates a compiler warning ("obsolete") in .NET 3.0.
If he's using VS 2003, then he's using 1.1 for sure.

MillDaKill: Do you need to add System.Web as a reference to your project?

MillDaKill
Aug 19, 2003

How could you Carl?

Richard Noggin posted:

Are you sure you're using the .NET Framework 1.1? System.Web.Mail was changed to System.Net.Mail in .NET 2.0, and generates a compiler warning ("obsolete") in .NET 3.0.

pretty sure, here is a screen grab from the about page.

MillDaKill
Aug 19, 2003

How could you Carl?

SLOSifl posted:

If he's using VS 2003, then he's using 1.1 for sure.

MillDaKill: Do you need to add System.Web as a reference to your project?

How do I go about doing that?

I can see system.web just not system.web.mail

MillDaKill fucked around with this message at 22:04 on Jul 12, 2007

Richard Noggin
Jun 6, 2005
Redneck By Default

SLOSifl posted:

If he's using VS 2003, then he's using 1.1 for sure.

MillDaKill: Do you need to add System.Web as a reference to your project?

Dammit, missed the '03 part.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
You probably just need to add a reference to the System.Web library. Try right clicking on the reference folder in your project and do add reference, or whatever equivalent there is for VB and VS.NET, since I have really only done stuff in C# and VS 2005

MillDaKill
Aug 19, 2003

How could you Carl?

Jethro posted:

You probably just need to add a reference to the System.Web library. Try right clicking on the reference folder in your project and do add reference, or whatever equivalent there is for VB and VS.NET, since I have really only done stuff in C# and VS 2005

Success. Thanks to all.

Shayla
Nov 4, 2004
I am having a bit of a datagrid problem. I'm trying to hide a few rows in a DataGrid running CF 2.0. This hasn't worked any way I've tried it.

code:
     DataSet ds = new DataSet();
     ds.Merge(STMCTI_Data.getDataTable("TreeSpecies_PDA"));
            
     ds.Tables["TreeSpecies_PDA"].Columns[0].ColumnMapping = MappingType.Hidden;
     ds.Tables["TreeSpecies_PDA"].Columns[1].ColumnMapping = MappingType.Hidden;
     ds.Tables["TreeSpecies_PDA"].Columns[4].ColumnMapping = MappingType.Hidden;
     ds.Tables["TreeSpecies_PDA"].Columns[6].ColumnMapping = MappingType.Hidden;

            
     dataGrid1.DataSource = ds.Tables["TreeSpecies_PDA"];
Any suggestions?

Edit: Fixed.

code:
      dataGrid1.DataSource = ds.Tables["TreeSpecies_PDA"];
      DataGridTableStyle ts = new DataGridTableStyle();
      ts.MappingName = "TreeSpecies_PDA";
      
      dataGrid1.TableStyles.Add(ts);
      dataGrid1.TableStyles[0].GridColumnStyles.RemoveAt(6);
      dataGrid1.TableStyles[0].GridColumnStyles.RemoveAt(4);
      dataGrid1.TableStyles[0].GridColumnStyles.RemoveAt(1);
      dataGrid1.TableStyles[0].GridColumnStyles.RemoveAt(0);
I am not a big fan of the workarounds for the compact framework, but I am sure it could be worse.

Shayla fucked around with this message at 15:38 on Jul 13, 2007

Celebrity Toaster
Jan 21, 2007

Don't worry boys, I'm on the guest list
I'm having a permissions problem with one of my .net applications. When the exe is run on a network drive, the runtime on that machine throws up security exceptions when trying to perform disk I/O or load external (unmanaged) dll's. From the error messages, I gather that the runtime is running my application under the LocalIntranet group. Looking through the .Net configuration tool I can see that this group is not allowed disk I/O access or unmanaged code.

After reading about the .Net permissions maze, i understand why its there and how to set up new permissions policies. I am still unclear as to how I can either alter the LocalIntranet permissions or have my application run under a different set of policies. Could anyone help me with this?

I am using the .Net 2.0 framework, the local machine(s) are XP SP2 and Vista, but the server may be windows2000.

salithus
Nov 18, 2005
:psyduck:

I may need to connect to a Progress DB (for Syteline) using a Merant driver. Right now, the majority of the desktops here don't have a DSN set up for it. I've googled for a bit, but am a bit lost as to how I would add it using Visual C#. Can someone point me in the right direction?

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe

pliable posted:

Doesn't seem to work. It seems that Explorer wants to keep a permanent lock for some reason on the file, so it's constantly throwing exceptions.

This is depressing :(. Regardless, thanks for the help so far guys, I appreciate it.

I lied.

I was using File.Move() incorrectly :(. I thought the second parameter needed just a file path, not the whole path plus the full file name.

Therefore, making it sleep for a few seconds and catching exceptions if it's still locked works. Thanks guys!

wwb
Aug 17, 2004

Celebrity Toaster posted:

I'm having a permissions problem with one of my .net applications. When the exe is run on a network drive, the runtime on that machine throws up security exceptions when trying to perform disk I/O or load external (unmanaged) dll's. From the error messages, I gather that the runtime is running my application under the LocalIntranet group. Looking through the .Net configuration tool I can see that this group is not allowed disk I/O access or unmanaged code.

After reading about the .Net permissions maze, i understand why its there and how to set up new permissions policies. I am still unclear as to how I can either alter the LocalIntranet permissions or have my application run under a different set of policies. Could anyone help me with this?

I am using the .Net 2.0 framework, the local machine(s) are XP SP2 and Vista, but the server may be windows2000.

What you do is make a new set of permissions and make that set fully trusted. Instructions are halfway down this page.

uXs
May 3, 2005

Mark it zero!

wwb posted:

What you do is make a new set of permissions and make that set fully trusted. Instructions are halfway down this page.

When I started to make .NET apps, I had problems with the permissions too. So I tried signing them and doing the permissions thing like you're supposed to do. But it's such a huge hassle that I just stopped doing that and now I'm just letting my programs be installed on either the user's PC or on the Citrix servers. In both cases I need some admin to install something, but at least they have experience with installing programs. They don't really with setting the .NET security policy.

So if you can avoid it by not running it from network drives, do so. Otherwise you'll have to do the security thing in the link above.

salithus
Nov 18, 2005
code:
private void dvUsedBatches_DragDrop(object sender, DragEventArgs e)
{
    Point clientPoint = dvUsedBatches.PointToClient(new Point(e.X, e.Y));
    rowIndexOfItemUnderMouseToDrop = dvUsedBatches.HitTest(clientPoint.X, clientPoint.Y).RowIndex;
    if (e.Effect == DragDropEffects.Copy)
    {
        DataGridViewRow newRow = new DataGridViewRow();
        newRow.Cells[0] = dvAvailBatches.SelectedRows[0].Cells[0];
        dvUsedBatches.Rows.Insert(dvUsedBatches.Rows.Count, newRow);
    }
}
That's not doing anything and it's not throwing any errors. Basically, I'm trying to copy via drag-n-drop from one DataGridView to another. Any ideas?

e: spelling

Also, for a better description, it's changing the mouse cursor to the copying cursor, but no new row shows up like I would expect.

salithus fucked around with this message at 21:01 on Jul 16, 2007

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe
Are there problems when it comes to connecting to SQL Servers via named pipes? I ask because I have a conundrum at hand :( :

I'd like to connect to my SQL server so I can manipulate data. I wrote a method in which I build a connection string with SqlConnectionStringBuilder(), and then return a string containing that connection string.

The first time I try to connect to the server, I get this exception:

quote:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

I'm pretty sure the server is configured to accept remote connections, as I'm able to log in with my account just fine from my workstation. Not only that, I wrote a previous website that was able to interact and connect to the server just fine via named pipes. I tried setting up a temporary login to use (to test and see if that would work), so I added the necessary information to the connection string for that with no luck.

So is it just an innate problem with named pipes? Or am I retarded and missing something obvious and vital (which is probably the case)?

Last but not least, here is my code:

code:
static string connString() {
   SqlConnectionStringBuilder stringBuild = new SqlConnectionStringBuilder();
   stringBuild.DataSource = @"np:xxxxx\xxxxxx";
   stringBuild.InitialCatalog = "xxxxxxxxxxx";
   stringBuild.IntegratedSecurity = true;
   stringBuild.UserID = "xxx"
   stringBuild.Password = "xxx"
   return stringBuild.ConnectionString;
}

void apTable() {
   using(SqlConnection con = new SqlConnection(connString())) {
         SqlCommand cmd = con.CreateCommand();

         cmd.CommandType = CommandType.Text;

         cmd.CommandText = "xxxxxx";

         SqlParameter id = cmd.Parameters.Add("xxxx", SqlDbType.Char);

         id.SqlDbType = SqlDbType.Char;
         id.Direction = ParameterDirection.Output;

         con.Open(); //Aforementioned exception thrown here because God and Microsoft hates me.

         cmd.ExecuteNonQuery();

         appID = (char)idOut.Value;
      }
   }
}
What can I check on the SQL server itself to make sure everything is configured properly?

Thanks as always for the help!

wwb
Aug 17, 2004

^^^So, are you using integrated security or are you using a SQL account? Pick one.

PS: A few other more useful hints. First, is the delay until exception long (as in 20 or so seconds) or short? If it is long, that indicates there is a transport-layer issue, but short indicates a permissions issue and login denied.

Anyhow, what you want to look at is the Sql Server Surface Area configuration tool, it is installed with sql client tools. You should be able to confirm that named pipes are working.

Final question--why named pipes?

wwb fucked around with this message at 17:27 on Jul 17, 2007

Munkeymon
Aug 14, 2003

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



salithus posted:

code:
private void dvUsedBatches_DragDrop(object sender, DragEventArgs e)
{...}
That's not doing anything and it's not throwing any errors. Basically, I'm trying to copy via drag-n-drop from one DataGridView to another. Any ideas?

e: spelling

Also, for a better description, it's changing the mouse cursor to the copying cursor, but no new row shows up like I would expect.

http://www.codeproject.com/csharp/DataGridView_Drag-n-Drop.asp

salithus
Nov 18, 2005

Already read it, and it tells me (poorly) how to drop data into a ListBox. Currently, I'm using:

code:
private void dvUsedBatches_DragDrop(object sender, DragEventArgs e)
{
    if (e.Data.GetDataPresent(typeof(DataGridViewSelectedRowCollection)))
    {
        if (e.Effect == DragDropEffects.Copy)
        {
            DataGridViewSelectedRowCollection copyRows = 
(DataGridViewSelectedRowCollection)e.Data.GetData(typeof(DataGridViewSelectedRowCollection));
            string newVal = copyRows[0].Cells[0].Value.ToString();
            foreach (DataGridViewRow row in dvUsedBatches.Rows)
            {
                if (row.Cells[0].Value.ToString() == newVal)
                    return;
            }

            int newRow = dvUsedBatches.Rows.Add();
            dvUsedBatches.Rows[newRow].Cells[0].Value = copyRows[0].Cells[0].Value;
        }
    }
}
It does the job for now, although currently multi-select is killed (since I want to use LMB, not RMB).

Celebrity Toaster
Jan 21, 2007

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

uXs posted:

When I started to make .NET apps, I had problems with the permissions too. So I tried signing them and doing the permissions thing like you're supposed to do. But it's such a huge hassle that I just stopped doing that and now I'm just letting my programs be installed on either the user's PC or on the Citrix servers. In both cases I need some admin to install something, but at least they have experience with installing programs. They don't really with setting the .NET security policy.

So if you can avoid it by not running it from network drives, do so. Otherwise you'll have to do the security thing in the link above.

Thanks for all the help guys :) I eventually got this sorted, although not without its troubles. It seems the .Net 2.0 configuration tool only ships with the SDK edition of the framework. Luckily my tool is only being used on maybe 10 computers, but i still didn't relish the thought of putting a 300mb install on each of them just to configure the security policies.

I found this blog entry rather helpful in assisting me with what i needed to do. It won't be of much use to most of you, but maybe someone in a similar situation will find it as lifesaving as I did :)

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe

wwb posted:

^^^So, are you using integrated security or are you using a SQL account? Pick one.

PS: A few other more useful hints. First, is the delay until exception long (as in 20 or so seconds) or short? If it is long, that indicates there is a transport-layer issue, but short indicates a permissions issue and login denied.

Anyhow, what you want to look at is the Sql Server Surface Area configuration tool, it is installed with sql client tools. You should be able to confirm that named pipes are working.

Final question--why named pipes?

I believe we're using integrated security

I believe it was sort of long, but it's doing other things besides trying to connect to the SQL server (I think I mentioned it before somewhere in this thread, but before, it monitors a folder for .zip files, then when one appears, it takes that, moves it somewhere else, unzips it, then reads an XML, THEN I try to connect to the SQL server to upload the info).

Thanks, I'll look at that.

Named pipes because...that's what I'm given to work with :(. I don't think we want to use IP or anything else, so.

Thanks again for your help, it's always appreciated wwb!

Jethro posted:

On the off chance you didn't figure this out, since I didn't see you explicitly say you changed it, if you are using integrated security, you do not need, and should not even have, a username and password.

Yeah, I got it :). Thanks for the heads up though. I've said it before, but SQL is pretty new to me, and I'm an intern here learning the ropes. Or more like, diving into the ropes head on and just figuring poo poo out on the way.

pliable fucked around with this message at 22:17 on Jul 17, 2007

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

pliable posted:

I believe we're using integrated security
On the off chance you didn't figure this out, since I didn't see you explicitly say you changed it, if you are using integrated security, you do not need, and should not even have, a username and password.

rckgrdn
Apr 26, 2002

So that's how it's made...

Dromio posted:

code:
    [System.Web.Services.WebMethod, System.Web.Script.Services.ScriptMethod]
    public string[] ColumnText_TextChanged(string prefixText, int count, string BoxName)
    {
        return new string[] { "First", "Second" };
    }
It never gets called. The cursor flashes for a second when the script fires off, but I never see the results on my dropdown and any breakpoints never get hit.
Well, it's probably too late for this, but what they don't tell you in the AutoComplete documentation is that if you're using a service method on your page rather than in a separate web service, it has to be static and conform to an exact signature. Here's an example of a working one from a page I've done:
code:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetProviderList(string prefixText, int count)

Dromio
Oct 16, 2002
Sleeper

thestoreroom posted:

Well, it's probably too late for this, but what they don't tell you in the AutoComplete documentation is that if you're using a service method on your page rather than in a separate web service, it has to be static and conform to an exact signature.
Thanks, but I already figured it out and moved on. I don't really remember what the problem was, I think the function was missing one of necessary attributes.

Vedder
Jun 20, 2006

Hi there

At work we had tonnes of files that needed to be scanned into a PDF format and placed in a network share. When a user scans a document it gets placed in there "Scan" folder on their C: drive in which they can rename it or whatever. To make life a little easier I made a small web application which allows a user to select the file they want, give it a name and from there the application adds all the relevant file extensions/conventions and puts it in the relevant folder. When the user has tonnes of files in C:\Scan they can press a button which deletes the files.

I developed this in Visual Web Developer and when I run it through this software it works as I want it to work. However when I put it on our network and give it a virtual directory, how do I stop the delete command deleting the contents of the Scan folder on the server, when I want it to delete the contents of whatever workstation's folder the user is uploading with?

Thanks in advance.

Potassium Problems
Sep 28, 2001

Vedder posted:

I developed this in Visual Web Developer and when I run it through this software it works as I want it to work. However when I put it on our network and give it a virtual directory, how do I stop the delete command deleting the contents of the Scan folder on the server, when I want it to delete the contents of whatever workstation's folder the user is uploading with?

Thanks in advance.

Someone correct me if I'm wrong, but I'm sure this isn't possible (unless you have an ActiveX control or something) as it would give way to a boatload of security issues.

Shayla
Nov 4, 2004
I'm having some issues casting an object (in an array) to int or Int32. Basically my code is:

cmbCityTree.SelectedIndex = (int)arrTreeData[(int)STMCTI_FieldList.CityTree];

This does not work. I'm getting InvalidCastException. I've tried assigning it to a variable before SelectedIndex, but still no go.

Fiend
Dec 2, 2001
I need to know which one of these methods is more expensive/inefficient and why. I'm trying to detect if a string value is a number.

This first method uses a regular expression, and will return true if the value can be converted to a whole number or int datatype:
code:
static bool IsNumeric(string val)
{
    System.Text.RegularExpressions.Regex isNumber = new System.Text.RegularExpressions.Regex(@"^\d+$");
    System.Text.RegularExpressions.Match m = isNumber.Match(val);
    return m.Success;
}
This second method uses the builtin tryParse method to determine if a value can be converted to an int datatype:
code:
static bool IsInt(string val)
{
    int iVal;
    return int.TryParse(val, out iVal);
}
Which one is the least expensive and why?

Thanks!
-Bobby Crosby

crwdog
Aug 31, 2002

Ryuichi posted:

I'm having some issues casting an object (in an array) to int or Int32. Basically my code is:

cmbCityTree.SelectedIndex = (int)arrTreeData[(int)STMCTI_FieldList.CityTree];

This does not work. I'm getting InvalidCastException. I've tried assigning it to a variable before SelectedIndex, but still no go.

Try using Convert.ToInt32() as in:

code:
int index = Convert.ToInt32( arrTreeData[ Convert.ToInt32( STMCTI_FieldList.CityTree ) ] );

if( cmbCityTree.Items.Count >= index )
  cmbCityTree.SelectedIndex = index;
else
  throw Exception( "I don't know why the index returned was not in my combo box" );

fankey
Aug 31, 2001

Fiend posted:

Which one is the least expensive and why?
It's easy enough to write a test. I guessed that the Regex was going to be much more expensive and it looks like I was correct. I moved the Regex outside the method since it's silly to reparse every time. I'm not sure what .NETs Regex implementation is but they usually have pretty high overhead due to their flexability. TryParse can theoretically bail as soon as it hits a non numeric character - looking at ParseNumber via Reflector it looks pretty optimized.
code:
  public class Program 
  {
    static System.Text.RegularExpressions.Regex isNumber = new System.Text.RegularExpressions.Regex(@"^\d+$");
    static bool IsNumeric(string val)
    {
      System.Text.RegularExpressions.Match m = isNumber.Match(val);
      return m.Success;
    }
    static bool IsInt(string val)
    {
      int iVal;
      return int.TryParse(val, out iVal);
    }
    static void test(string val)
    {
      System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
      sw.Start();
      for (int ix = 0; ix < 10000; ix++) IsNumeric(val);
      sw.Stop();
      double IsNumericTime = sw.ElapsedMilliseconds;
      sw.Reset();
      sw.Start();
      for (int ix = 0; ix < 10000; ix++) IsInt(val);
      sw.Stop();
      double IsIntTime = sw.ElapsedMilliseconds;
      System.Console.WriteLine("testing '{0}', IsNumeric : {1}ms, IsInt : {2}ms", val, IsNumericTime, IsIntTime);
    }
    public static void Main(string[] args)
    {
      try
      {
        test("12345");
        test("this is not a number");
        test("13092134092340923142343943");
        test("13092134092340923142343943ss");
      }
      catch (Exception ex)
      {
        Console.WriteLine(ex.Message);
      }
    }
  }
with the following results
code:
testing '12345', IsNumeric : 11ms, IsInt : 3ms
testing 'this is not a number', IsNumeric : 13ms, IsInt : 2ms
testing '13092134092340923142343943', IsNumeric : 24ms, IsInt : 4ms
testing '13092134092340923142343943ss', IsNumeric : 36ms, IsInt : 4ms

Vedder
Jun 20, 2006

Lone_Strider posted:

Someone correct me if I'm wrong, but I'm sure this isn't possible (unless you have an ActiveX control or something) as it would give way to a boatload of security issues.

Thanks for clearing that one up. As the application is only used by one or two people I can stick it on the machine's IIS.

wwb
Aug 17, 2004

Fiend posted:

I need to know which one of these methods is more expensive/inefficient and why. I'm trying to detect if a string value is a number.

This first method uses a regular expression, and will return true if the value can be converted to a whole number or int datatype:
code:
static bool IsNumeric(string val)
{
    System.Text.RegularExpressions.Regex isNumber = new System.Text.RegularExpressions.Regex(@"^\d+$");
    System.Text.RegularExpressions.Match m = isNumber.Match(val);
    return m.Success;
}
This second method uses the builtin tryParse method to determine if a value can be converted to an int datatype:
code:
static bool IsInt(string val)
{
    int iVal;
    return int.TryParse(val, out iVal);
}
Which one is the least expensive and why?

Thanks!
-Bobby Crosby

TryParse is probably the best of the bunch you have up there. I don't have reflector handy to check the implementation, but it is reputed to be very fast. See this blog post for some faster methods.

Ethangar
Oct 8, 2002

I just got done writing a real-time line graph and spectrogram (linked because spectrograms are pretty), but now I need some sort of hierarchy chart or node graph. What I really want is one that will automatically plot a TreeNode structure. Ideally, it really wouldn't be too different than a TreeView, but there would be big rectangles or images for the user to click on and deal with.

Such a thing exist? Commercial is ok.

Inquisitus
Aug 4, 2006

I have a large barge with a radio antenna on it.
I've been considering the different ways of handling logging, but I'm not sure which is best.

The Trace/Debug classes are great for simple messages in application assemblies, but when you need detailed logging output from lots of libraries and applications, they don't really work; you can't specify any additional information, you can't specify where the log message came from without explicitly saying so in the message itself, you can't have different levels of logging verbosity, etc.

I've also been playing around with a set of classes and interfaces I've written that basically follow the observer pattern: any class that might want to log stuff implements an interface that specifies a log event. A listener can then be subscribed to that event manually or you can just take a load of objects implementing the logger interface and plug them into a listener.

This is good because it allows you to selectively log messages from certain objects, but it also requires that you modify the class's public members simply to facilitate logging, which is far from ideal.

How do you guys handle logging in your applications and libraries?

Nurbs
Aug 31, 2001

Three fries short of a happy meal...Whacko!
Does anyone know how to call a function from a string of its name?

I have <x> # of textboxes on my form, each of which needs to run code to update or insert a record into the database.

Now I can't have the code running every time the text changes because that will be too often. I set up a timer that each textbox will start when the user starts typing, and it will be reset each time the text changed event starts. So when the timer tick event can only fire when the user finishes typing.

What I want to do is have a data table with columns for textbox name, flag, function name.

When the timer tick fires, I want to be able to execute the corresponding function for the textbox which has been editted (which is determined if the flag is set) I select from the datatable based on the name of the textbox, check the flag and then call the function.

Or if you have a better idea I'd like to hear it.

TextBox_TextChanged -> Timer_Tick -> private void function(no parameters)

salithus
Nov 18, 2005

Nurbs posted:

stuff

I'm confused. Why don't you either use the Exit event, or better yet use an updatable DataGridView or something?

Inquisitus
Aug 4, 2006

I have a large barge with a radio antenna on it.

Nurbs posted:

:words:
Can you not use delegates? Instead of having a function name, have a MethodInvoke delegate (or any other delegate) and just call that directly.

Nurbs
Aug 31, 2001

Three fries short of a happy meal...Whacko!

salithus posted:

I'm confused. Why don't you either use the Exit event, or better yet use an updatable DataGridView or something?

I actually just thought of doing that. Not perfect for search boxes but it'd fit for the textboxes that serve for record editting.

As for DataGridView, I use plenty of those but these aren't fields that I'd put in those.

I'll look into delegates, but will probably stick with a exit event.

Adbot
ADBOT LOVES YOU

MrBishop
Sep 30, 2006

I see what you did there...

Soiled Meat

Inquisitus posted:

:words: logging...
I've been using log4net for logging in my dotnet apps, and have been pretty satisfied with it. The documentation isn't great, but there are some tutorials out there for setting it up that helped me get up and going.

  • Locked thread