Friday, September 18, 2009

How to make the DataGridViewComboBoxCell actually behave like one

Even though the DataGridViewComboBoxColumn has a property for DisplayStyle which can be set to either DropDownButton or ComboBox (or Nothing), there's virtually no difference that I can see between the two settings. What I want is to be able to type text into the control like a normal ComboBox. I was disappointed to find out that this functionality is not built in. But after some struggle tracking it down (which is why I'm posting this), I did find some information about how you can actually make it work (kind of). These are the key events:


private void dataGridView1_EditingControlShowing(object sender,
DataGridViewEditingControlShowingEventArgs e)
{
ComboBox cbo = e.Control as ComboBox;
if (cbo != null) {
cbo.DropDownStyle = ComboBoxStyle.DropDown;
cbo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cbo.AutoCompleteSource = AutoCompleteSource.ListItems;
cbo.TextChanged -= new EventHandler(cbo_TextChanged);
cbo.TextChanged += new EventHandler(cbo_TextChanged);
}
}



private void dataGridView1_CellValidating(object sender,
DataGridViewCellValidatingEventArgs e)
{
object eFV = e.FormattedValue;
DataGridViewComboBoxCell cbc = dataGridView1.CurrentCell as
DataGridViewComboBoxCell;
if (cbc != null && !cbc.Items.Contains(eFV))
{
cbc.Items.Insert(0, eFV);
}
if (dataGridView1.IsCurrentCellDirty)
{
dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit);
}

cbc.Value = cbc.Items[0];
}



private void cbo_TextChanged(object sender, EventArgs e)
{
dataGridView1.NotifyCurrentCellDirty( true );
}

Thursday, January 22, 2009

First impressions of JavaScript, from an old timer coming from Java/C#

It's interesting. There are no classes (exactly) or Main() method. Just put that code anywhere. Just create random global variables of some mysterious type that is at the same time no type and every type. Tack on random properties and methods anywhere and everywhere at your whim. Classes are implemented as functions and functions within functions. Everything works differently, yet it still manages to emulate object oriented programming effectively to some degree. JavaScript, you're not replacing my C#, but I was doubtful and yet you've managed to impress and intrigue me. You have evolved, and I'm having fun with you. <-- my ode to an inanimate programming language

Sunday, September 23, 2007

Reporting Services authentication on a Windows XP workgroup

After setting up my RAID server, I had installed Reporting Services on it, but until today I had not been able to connect to it from other computers in the workgroup. I would get the login prompt, but it would not accept any valid users.

After a lot of wasted time googling down the wrong trails, I finally found this excellent article that does a great job of explaining and provided the solution: http://www.windowsnetworking.com/articles_tutorials/wxpsimsh.html

The problem is on Windows XP, "simple file sharing" is turned on by default AND when it is, no matter what logon / password you use, the server uses the Windows Guest account instead. So even though I entered BlahBlahTest as the username, I was getting access denied messages because even through BlahBlahTest has access, Guest does not.

The weird thing is that I had tried turning off simple file sharing earlier in the night, and not only did it not fix the Reporting Services problem, but it also broke the file share I already had set up under simple file sharing; so I had turned it back on immediately.

The next day, I read this article, tried turning off simple file sharing again, created a new share -- for testing... both the new share and the existing share were fine, AND Reporting Services authentication worked perfectly. Weird and frusrating, but I'm happy it's fixed!

I had tried setting up VPN and a few other things requiring authentication a year or more ago, and had all kinds of problems. Now I realize that it was probably the same issue, it was ignoring the account I had set up, and using the Guest account instead. I'm excited to try some of this stuff again. Blogging this to remember what the deal was and save hours of googling again :)

Another useful thing I learned is that with Windows XP and higher, you can go into User Accounts on the control panel, and on the sidebar there is an option to "Manage your network passwords". By adding entries here, you aren't forced to use the same user on both the server and client machines. If your client user is different, just store the appropriate name and password for the network share here so you aren't prompted each time. Cool!

Just make sure simple file sharing is turned off on the server so it's not actually using the Guest account. ;)

Saturday, August 18, 2007

Missing Winamp context menu options

This has been bugging me for a while. I thought I tracked down the problem after some digging on the Winamp forums. I hoped uninstalling Magic ISO & Nero ShowTime might solve it. Still no luck. I just want to be able to "Enqueue in Winamp" again.

http://forums.winamp.com/showthread.php?s=235637e0f396983044d17290c1c55e1e&threadid=266117&perpage=40&highlight=context+vista&pagenumber=2

Saturday, July 07, 2007

Weirded out

Instead of typing in the URL to get to this site and submit that last post, I googled my own name; and was shocked to see that the second link on Google for my name is a Youtube video of, apparently myself getting shot in the butt with a paintball gun!?!? I don't remember that happening! I don't know those people... Freaky....... !

How to fix Xbox Live so I can chat with and join games with Ben

I keep having this problem, where Ben and I can't connect to each other's games, or connect to audio chat on Xbox live. To fix it:

The problem is that you need to get "NAT" to show up as "Open" instead of "Moderate" or "Strict" when you run the Xbox 360 network test. If you can get that, it's fixed.

Ports 88 and 3074 need to be getting forwarded to the Xbox 360 IP address. I had fixed this before, but started seeing the problem again after the Xbox IP address changed and the ports were getting forwarded to the old address. That's why I'm writing this blog entry.

However, when I tried to fix it, I set the Xbox IP to be a static address. That didn't work out. Just keep the Xbox network settings at "Automatic" and update the router to forward the ports to the new address instead.

That should work!

Saturday, February 10, 2007

Note to software developers

  • Do NOT, as a part of your software installation package, install or offer to install some other completely unrelated software package. Certainly, NEVER install it by default.

Of course, this whole practice started with spyware, where that "cool game" your kid downloaded silently installed some additional software that hijacks your browser and takes down your internet connection. But it's starting to really frustrate me to see installers for software from somewhat respectable companies install unrelated software from other companies, some of which are also somewhat respectable.

And just to be clear I'm not talking about a game that requires DirectX installing DirectX, or an application that requires the .Net framework installing the .Net framework.

The sort of thing that makes me mad is what happened just now when I was installing an update to the Java run time environment. Can someone tell me what the *@#! the Google Desktop has to do with the Java run time environment getting updated? Because for some reason asking if I want to install it is a step in the Java update installation process!

Java, Google... shame on you!

On a side note, no, I do NOT want to install the Google Desktop. I DO religiously use the Google toolbar and the Google DeskBAR, but I did not like when they stopped the DeskBAR and forced the entire DeskTOP on you. Luckily you can still find the last DeskBAR installer on the internet and it still works great!

Some other offenders, that used to be just great software but started adopting this horrible practice are:

  • Adobe Reader installing Yahoo toolbar
  • Nero installing Yahoo toolbar
  • Winamp installing "eMusic", AOL shortcuts, etc.
  • Daemon Tools installing some "search" software
  • Real Media player... the worst... I stopped installing it a long time ago

STOP DOING THIS... It's bad... ok?

Monday, January 01, 2007

Certified

I passed my second Microsoft certification exam over the holiday break. So now I can say that I am Microsoft certified with the title of: "Microsoft Certified Technology Specialist: SQL Server 2005". :)

Saturday, December 16, 2006

Yama the Lord of Death

Today we went to the Field Museum of Natural History in Chicago. We went for the King Tut exhibit, but my favorite thing that we saw today was actually this statue of a demon with a crown of human skulls and a necklace of severed heads... oh yeah, I guess the guy also "holds a loop of rope in his left hand with which he pulls the soul from the corpse"...

Even better is his story, from Tibetan Buddhism:

"A holy man was told that if he meditated for the next 50 years, he would achieve enlightenment. The holy man meditated in a cave for 49 years, 11 months and 29 days, until he was interrupted by two thieves who broke in with a stolen bull. After beheading the bull in front of the hermit, they ignored his requests to be spared for but a few minutes, and beheaded him as well. In his near-enlightened fury, this holy man became Yama, the god of Death, took the bull's head for his own, and killed the two thieves, drinking their blood from cups made of their skulls. Still enraged, Yama decided to kill everyone in Tibet."

I mean, come on, that's just freaking awesome. Quoting another guy who walked by the display, that's "badass"... !

Now playing: Ecuador Manta - Chiman

Friday, December 15, 2006

GameFly update

I kept GameFly for one more month after my rant and then ended up cancelling it. A local video store offers a similar deal, so I switched to that. It's nice to be able to switch games as often as I want without having to deal with postal delays. They've usually got a great selection and are decent with getting new items. Plus it's supporting a local business that I happen to really like. So there. Congrats to Sunset Video of Waukesha WI for stealing one of GameFly's customers with their 2 game monthly plan for $26.26 after tax (vs. GameFly's $23.07 after tax).

Thursday, September 07, 2006

GameFly rant

To: support@gamefly.com

Subject: FastReturn?

In my "Game Shipped" email, I was informed that my game "was shipped via FastReturn". Now, I would not have contacted you like this, but that statement just hit me as being SO ironic that I had to. The experience returning my last game, was such a bad experience for me, that I was SO close to cancelling my GameFly account on the spot last night. I was even billed one day before and would be throwing away $23. I didn't care. I did not cancel last night but I'm so upset about it that I still might cancel as soon as I receive the shipped games, or shortly after. I have not decided.

And the thing is, I actually really love the GameFly concept; and have had an excellent experience with the service for the most part. I really would like to continue the service. It's just getting to the point where I have to decide: for my recurring monthly membership fee, do all the benefits outweigh this frustration? I don't know how much longer I can answer that question with a "yes". Every time I have returned a game I have had this "problem".

Let me describe this last experience to you. I read some reviews on two recently released games. With the games at the top of my queue, I excitedly pack up my current games and put them in the mail Tuesday August 29. The mailman picks them up that day. I should have known better from my previous experiences, but I still check the web site each day for an update in status, realizing that the process does take time. One week later, Tuesday September 5, my games have been acknowledged as having been mailed, and the next games start to ship out. What? I thought that was the point of FastReturn? You get the FastReturn confirmation when the post office receives the game (Tuesday August 29) and the next game ships immediately? This whole time I thought my local post office didn't offer "FastReturn". But no, this WAS FastReturn. Fast is the last word I would have used to describe it.

Even worse, I see that the games being shipped are not the ones I wanted, #1 and #2 in my queue, but #3 and #4 that I have lost all interest for in my excitement over #1 and #2. I would have preferred to wait a couple days for #1 and #2, but there is no functionality to do this.

I know, it's not the end of the world. It's all pretty silly really. I'm not angry about it. You're doing a reasonable job of shipping. There was a weekend in there, one of the days was a holiday, it's not a huge number of business days. I know I'm being somewhat unreasonable in my expectations. But the fact remains... this piece of the service just isn't working out for me. And I really wish it could, somehow. Because then GameFly would seriously be perfect... ! It's awesome to be able to rent a game and play it all the way through with no time limits, and the potential to try new and different games. But a week with no games period... that's 1/4 of the time I'm paying for, that I'm unable to use the service... a week, and I haven't even received the games yet. I have to go through this every time I return a game. Each time I'm more convinced that it's not worth it.

Considering the turnaround time with FastReturn, it doesn't even make sense to return games more than once a month. Which sucks if you pick a crappy game, and defeats the purpose of being able to try new games. In fact, I don't think GameFly even works for new releases at all... at least I haven't figured out a "strategy" that works for new releases.

I still don't know where I am at with this. Writing this isn't going to accomplish anything. But, because there are aspects of the service that I like so much, I am taking some time to provide this feedback instead of silently pressing the cancel button and GameFly losing one insignificant customer. This one small exception unfortunately has a large impact on an otherwise excellent experience.

Sincerely,
Dan Puza

Monday, May 29, 2006

44.5 hours later...

That's how long it took to "migrate" from a 300GB RAID 1 array to a 600GB RAID 5 array... not counting the time (probably just as long) that it took to XCOPY the data over to the RAID 1 array in the first place. The nice part is that I was fully able to use the drive and the machine during the process. Now everything is finished and working beautifully!

Thursday, May 18, 2006

You are running very low on disk space on C:. To free space on this drive by deleting old or unnecessary files, click here.

I finally broke down and bought the hardware RAID 5 controller card that I've been drooling over for half a year... $620, just for the card, ouch...

The good news is that my storage capacity increases from 300GB to 600GB with redundancy. And I can expand as needed, up to 9 more drives... 3.22 terabytes >:-D

Can't wait for all the components to arrive... :)

Wednesday, May 17, 2006

Fun with Windows Forms #1

The exception:
System.ArgumentOutOfRangeException: InvalidArgument=Value of '-1379311' is not valid for 'length'.
Parameter name: length
at System.Windows.Forms.ComboBox.Select(Int32 start, Int32 length)
at System.Windows.Forms.ComboBox.set_SelectionStart(Int32 value)

The code:
ComboBox cb;
cb.SelectionStart = cb.Text.Length;

The fix:
cb.Select(cb.Text.Length, 0)

Monday, May 01, 2006

Visual Studio Keyboard Tricks

I just recently figured out these keyboard tricks and they are great for working in Visual Studio and SQL Server. I'm using them all the time now!

Ctrl-Left: Move cursor back one "word"
Ctrl-Right: Move cursor forward one "word"
Ctrl-Del: Delete "word" to the right of the cursor
Ctrl-Backspace: Delete "word" to the left of the cursor
*combine with Shift to highlight at the same time

Visual Studio only:
Start/stop recording keyboard macro: Ctrl-Shift-R
Playback keyboard macro: Ctrl-Shift-P
Ctrl-I: "Incremental search" (try it out!)

Old news, right? But I was too lazy to go look this stuff up before now. ;-)
It's almost like working in Emacs again...

I'm especially pleased with this next one: The "snaplines" feature for Visual Studio Windows Forms is great, but it's annoying when it sometimes makes it impossible to resize or reposition a control the way you want to because it's snapping to some other random control on the form. Well, I found out that you can temporarily disable the snaplines by holding down the Alt key while you reposition or resize your control... nice!

Now playing: Andain - Beautiful Things (Josh Gabriel Mix)