|
hi,
i have to add a button save in the dataGrid in order to save the changes i made in the checkBoxs for each row,
syntax Help plz for the button , the detecting of current row in DataGrid
vb.net 2003
thanks
|
|
|
|
|
I found all of this information out for myself from Google and trial and error, Im glad to help but we cant tell you every step of the project.
Anyway, this is another template column with a button and a command to call OnClick. Unless you are talking about a Editable datagrid and then you should Google for that.
Cleako
-- modified at 10:16 Wednesday 14th February, 2007
|
|
|
|
|
Hi..
I want to know how to extract the zip file using vb.net. If any one know please help me.
Thanks.
Navas.M
|
|
|
|
|
|
When it comes to coding I think I am too paranoid about input and I would like some feedback to help me rid myself of the obsession (Im not talking about input validation but rather Null Reference Exceptions or formatting strings that need to be non-blank).
I almost always perform 2 checks on a string and include a trim no matter what.
If strValue IsNot Nothing AndAlso strValue.Trim <> "" Then
I have read some things saying that I should probably use strValue.Length > 0 . What I am curious about is should I always perform the .Trim or is if strValue = " " considered 0 length?
Also on DB items I usually perform 3 checks.
If dr.Item("ColumnName") IsNot DBNull AndAlso dr.Item("ColumnName") IsNot Nothing AndAlso dr.Item("ColumnName").ToString.Trim <> "" Then
How much of that is necessary?
This may seem ridiculous but I guess Im tired of doing so much if I dont need to.
Thanks!
Cleako
|
|
|
|
|
cleako wrote: I almost always perform 2 checks on a string and include a trim no matter what.
If strValue IsNot Nothing AndAlso strValue.Trim <> "" Then
If you are using .NET 2.0 this can be shortened to
If Not String.IsNullOrEmpty(strValue) Then NOTE: It doesn't trim the string first.
cleako wrote: What I am curious about is should I always perform the .Trim or is if strValue = " " considered 0 length?
" " is considered to be not empty. An empty string contains zero characters.
cleako wrote: If dr.Item("ColumnName") IsNot DBNull AndAlso dr.Item("ColumnName") IsNot Nothing AndAlso dr.Item("ColumnName").ToString.Trim <> "" Then
How much of that is necessary?
It depends on what you are checking for. You could make it more efficient by assigning the result to a local variable first then it doesn't have to repeatedly look up the value for the column.
Personally, if you are having to trim whitespace off the strings all the time I'd tread that as a data error and would try to clean the data at source first. NOTE: if you are using a CHAR column in the database then it will always space pad the value. I'd recommend moving to VARCHAR unless you have a compelling reason to stay with CHAR (e.g. A legacy system you share the database with would freak if it wasn't space padded)
|
|
|
|
|
Hey,I'm new for the group, I have a little problem with menuItems.
I'm developing a pocket pc application in vb.net (compact framework), so I have a indefinited number of "Inherits System.Windows.Forms.Control" and
only one "Inherits System.Windows.Forms.Form" alias the MainForm.
In this MainForm I have created the menu and I have added the menuItems visible for all the "Controls".
I want personalize the menuItems and render visibles some Items in some controls and not in other.
which is the best way to improve my code?
I've tryed to disabled my menuItems with the fragment "me.menuItem.disabled = true" in maiform, and it give back correcty disabled the component in every forms, but i I want render it disabled in an other form what I should do?
thank to everybody!
daniele castrovinci
|
|
|
|
|
What is form handle in .net and at what time we will create and use them?
|
|
|
|
|
.NET is a wrapper on Win32, so a handle, is basically the same thing it's always been. You never create one, it's just something that every form has, because it is, at the end of the day, a Win32 window.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You may use the handles of forms when using API commands.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi all,
How could I take the values of cells in the dataGrid and use them outside the dataGrid
e.g:
i have TimeIn & TimeOut for a certain person during one month (or more or less)
i need to calculate the total hours ' in the specified time and view the total in a textBox
syntax help (examples) is also needed
thank you
|
|
|
|
|
There are really 2 choices here. You can grab the values out the datagrid, which means you would probably want to use the OnItemDataBound event and calculate the hours for each row as it is added or you can look at the datasource you are providing and get the values from there.
For the OnItemDatabound event you can do a case statement like this (this is from memory so forgive me if it isnt exactly correct) -
Select Case e.Item.Type<br />
Case Item<br />
'Calculate from cell contents and get a TimeSpan object<br />
ts = Convert.ToDateTime(e.Item.Cells(#).Text).Subtract(Convert.ToDateTime(e.item.Cells(#).Text)<br />
<br />
txtTotalHours = ts.TotalHours<br />
End Select<br />
Something along those lines, I hope that helps!
Cleako
|
|
|
|
|
Hi, i will try to solve ur problem. The values u entered i mean the employee values that was stored in a table right, again if u want to retrive that values and display on data grid right, if yes means the values u stored in data grid while retriving then create a local variable that supports the perticular data type on which u are operating, with the index of the recordset suppose TimeIn t1 and TimeOut t2 then t2 - t1 for every loop of that perticular employee and keep adding the result to the local variable at last when the record set is empty then assign the value to the textbox out side the grid,I think u may confused but i did it, if u want more information abt this then mail to me
|
|
|
|
|
thak you both Rahul Appu & cleako
srour_costavo@hotmail.com
this is my email so if u have msn add me and we can discuss more online
10x a lot
|
|
|
|
|
how could I convert a value in the dataGrid to string in order to use it outside the grid?
|
|
|
|
|
You either need to do something like OnItemDataBound because that will let you access each row or you will need to know the row index and cell number in order to access the .Text property which returns a string. I have found that many times though it will return a & nbsp; (spaced so it will show up) value so I almost always do a .Text.Replace("& nbsp;", "") on the value to make sure I dont have that HTML space.
Check out http://www.datagridgirl.com/[^], there you will find many datagrid answers.
Cleako
|
|
|
|
|
I'm a newbie at VB.Net so please don't smite me for this stupid question
I have a form with various buttons eg. movies, music, setups etc.... and i would like a windows explorer window to open up to the relevent directory on my HDD. Example if i clicked "Movies" it would open "D:\Movies" in a normal windows explorer window.
The only problem with my plan is that I don't know the code to make this happen. so could anyone help me??
Thank You
|
|
|
|
|
Process.start will take a path, and open it, I believe.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks a Million Mate that worked!
|
|
|
|
|
You need to include a FolderBrowserDialog in your program.;)
|
|
|
|
|
Why? The specs in the OP didn't say anything about picking the folder...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Why? The specs in the OP didn't say anything about picking the folder...
I have a form with various buttons eg. movies, music, setups etc.... and i would like a windows explorer window to open up to the relevent directory on my HDD. Example if i clicked "Movies" it would open "D:\Movies" in a normal windows explorer window.
You can also tell FBdialog what dir to start from, which open up in a windows explorer windows.
Which is what the person wanted.
As long as everybody is happy and get the answers that help them.......
|
|
|
|
|
He says, he's a newbie. To me, that means he want to open a hard coded (I know, bad idea!) path for each button.
Now, if he wanted to write a configuration section for his app, then he can supply the FBDialog to get the folder and make the app a bit more user friendly. But, I didn't see that in the OP.
I know, it sounds like I'm harpin' on you. I'm really not. If the OP wants to finish reading this thread, then he can see this idea and start asking questions to take his app to the next level.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi I am having the function like this,
Public Function GetColorFromString(ByVal strColor As String) As System.Drawing.Color
Dim colConvert As New ColorConverter
Return colConvert.ConvertFromString(strColor)
End Function
I got error while compiling
"Option Strict On disallows implicit conversions from 'System.Object' to 'System.Drawing.Color'."
How to resolve it?
Be simple and Be sample.
|
|
|
|
|
Do the cast explicitly ( however you do that in .NET ). CType, I think.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|