
melegant
Avatar/Signature-
Posts
52 -
Joined
-
Last visited
About melegant
- Birthday 10/15/1975
Personal Information
-
Visual Studio .NET Version
.NET Professional
-
.NET Preferred Language
VB.NET
melegant's Achievements
Newbie (1/14)
0
Reputation
-
Fix the annoying TreeView DoubleClick-Expand event
melegant replied to keitsi's topic in Windows Forms
Here is the C# equiv: public class TreeDblClickPrevent { private TreeView m_tv; public TreeDblClickPrevent(TreeView tv) { m_tv = tv; tv.BeforeExpand +=new TreeViewCancelEventHandler(tv_BeforeExpand); tv.MouseDown +=new MouseEventHandler(tv_MouseDown); tv.BeforeCollapse += new TreeViewCancelEventHandler(tv_BeforeCollapse); } private long m_FirstMouseDownTime; private bool blnDoubleClick = false; private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e){ //handles m_tv.BeforeExpand if(blnDoubleClick == true && e.Action == TreeViewAction.Expand) e.Cancel = true; else m_FirstMouseDownTime = 0; } private void tv_BeforeCollapse(object sender, TreeViewCancelEventArgs e){ //Handles m_tv.BeforeCollapse if(blnDoubleClick == true && e.Action == TreeViewAction.Collapse) e.Cancel = true; else m_FirstMouseDownTime = 0; } private void tv_MouseDown(object sender,System.Windows.Forms.MouseEventArgs e){// Handles m_tv.MouseDown if(System.DateTime.Now.Ticks - m_FirstMouseDownTime <= (SystemInformation.DoubleClickTime * TimeSpan.TicksPerMillisecond)) blnDoubleClick = true; else blnDoubleClick = false; m_FirstMouseDownTime = System.DateTime.Now.Ticks; } } Then in your form just pass the treeview in question to the attach the handlers: TreeDblClickPrevent treep = new TreeDblClickPrevent(tvMain); -
Having fun fun trying to find the best way to convert Double values to fit into Text property of TextBox.. Ex. //txtNum1 and txtNum2 are two TexBoxes on a form that are adding money txtTSCTax.Text = Double.Parse(Convert.ToString((Convert.ToDouble(txtNum1.Text) + Convert.ToDouble(txtNub2.Text)))).ToString("C"); This can't be the way..it just can't be. Thanks Mele~
-
GRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR So, I populate a datagrid from a datatable ..select blah blah from blah blah etc. Populates like a champ, scollbars are there... Now, on the form resize event, I resize the datagrid and BLAM GOOD BYE SCROLLBARS i can't figure out how to get them back..It's really making me upset because it's a huge project and this is the ONE STUPID THING holding me back. thanks!:D
-
I am constructing a data grid from a couple of different queries. I need to call a stored procedure every time a user changes a value in a cell in a datagrid. I am stuck on what type of event to use to make this happen. i tried using a tablestyle, adding datagridtextboxcolumns, then adding an event handler to each box. I tried the leave, textchanged, and enter methods, and nothing works 100 percent of the time. Is there some easy event that am missing? something releated to datagrid cell? Some other way to do this on a cell by cell basis? Eppp help! Peace. :p
-
Yeah, the aspnetreg buisness worked fine.. Thanks.
-
GRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR Ok, everything in VS 2003 was hunky dorey, made a sweet ASP application, I restart IIS because I changed the ASPNET local password and VIOLA "The Web server reported the following error when attempting to create or open the Web Project Located at the following URL: 'http://localhost/WebApplication1. 'Http/1.1 500 Internal Server Error" But when i do the same thing in 2002, it works fine. I found a few articles and posts but no solid answers. I am using IIS 5 with Windows 2K. I REINSTALLED the framework (1.1) and IIS. What the hell is going on please help. Thanks
-
I had tried that and it still returned a short date (which threw me). ..>Maybe I did something wrong let me try again. For know I set up a function to translate the date.now.month.tostring to a String rep. (the day and year are already numbers (: ) ~!
-
Is there a simple way to convert 10/11/2003 to October 11, 2003 ThANKS!
-
Excel Won't DIE..please help!
melegant replied to melegant's topic in Interoperation / Office Integration
Nars Privte Sub Nars(o as Object) Try System.Runtime.InteropServices.Marshal.ReleaseComObject(o) Catch Finally o = nothing End Sub I have to say that would not work well either..so this is what I did Private Sub KillExcelPr() Dim mp As Process() = Procss.GetProcessesByName("EXCEL") Dim p As Process For Each P in mp If P.Responding Then If p.MainWindowTitle = "" Then p.Kill() End If Else p.Kill() End If Next p End Sub and there it is folks. that will kill any excel running in memory that does not have a title window. ( meaning if the user has a spreadsheet open otherwise, it won't get killed) Peace. -
Eureka! I figured out what the problem was... it's funny when solutions present themselves..i had just gotten home from work, i was preparing to go out to the city , washing my hands thinking about who would be the next american idol, when it hit me... I wasn't calling the sql adapters schema fill method when i loaded the grid.. i called it right before the update (need to to use the command builder) but not on the form load.. and sure enough it worked. i have no idea why it works on my VS pc's without doing this but i suspect it might have something to do with the fact that i have sql server stuff installeD? not sure but hey it worked. the post about the id not matching the primary key clued me in! thanks! mel
-
I have an app that has a form that has some text boxes that display some numbers that i fill by querying a sql database and using a datreader etc... now, on my pc and laptop that has VS, any number with a decimal will appear like so 5.5 or 5 now, on any other machine it appears like this 5.0000 the datatypes in sql range from smallmoney, money and decimal. why is this happening? it is creating havoc on my stored procedures where i did not plan for 4 decimal places. thanks!
-
Well, I have finally found a pattern but still not a real answer..close now..ever close. A quick bit on the datagrid i have..its a part list , with prices, discounts, descriptions and model #'s. Now, the submit routine i have basically sends grids datasouce, which is a datatable, through the dataadpater as an update and then i refresh the grid. (have to actually set the datasource = nothing first to clear it but anyway) I have discovered that on the machines where it does not work (Row deletion that is) if i first make a change to a field in the datatable and send the update, THEN i can delete rows ok. I am not sure what this means...excepet that i am a step closer!
-
Yes I have....It has to be something about the number system of the other machines... or mdac maybe? argh i don't know it's killing me. the users are about to stone me to death.
-
Yes, 1.1...EVERYTHING else works with the datagrid, updating, adding etc..only when I try to delete the row ):
-
Argh, I have an application with a datagrid in it, and it displays some parts ... so, i crated a routine that after it's deleted it submits the datagrid through the dataadapter to the db..everything is hunky dory.. EXCEPT WHEN I run the applicaiton on any computer that does NOT have vs.studio.net installed on it..then i get an error that says 'deleted row information cannot be accesed through the row.' EVERY other aspect of the app works like a charm on these other machines.. I don't get it..please help ..there are 40 plus people here waiting on this and they are DRIVING ME NUTS!! peace mel