|
Check out FILEINFO as it will give you what you need.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi all,
i am using master page in my project..
i am getting design issue...
it's working properly for IE, when it come to Fire fox,it not showing properly.how to fix it.
please help me..
Thanks in advance.....
JohnDas
|
|
|
|
|
Firstly, you need to provide more details of your problem, I'm guessing that it is a layout problem but you have to confirm this. Also, you will be better off posting on the correct board, the ASP.NET board (or maybe Web Development if it's a CSS issue). You're more likey to get an answer there.
|
|
|
|
|
Hi
When u look a page in IE and Firefox there is some small changes is there it is difficult correct. If it is huge change is there may be following problem are there.
1. CSS.
2. Browser Supportive.
3. alignment.
4. XML or backend coding
Etc....
|
|
|
|
|
In C# I have a form which creates an object of my class DirtyMarker for which I pass (among others) a reference to my closeControl.
In the DirtyMarker class I have this code:
pCloseCtrl.Click += new EventHandler((pObj, pArgs) =>
{
if (this.formIsDirty)
{
MessageBox.Show("There are unsaved changes, please save the changes before closing.");
}
else
{
pForm.Close();
}
});
How would I do this in VB?
My concern is not with the anonymous function, but rather with adding the "new" event.
Regards!
|
|
|
|
|
Adding an event is done by using the 'Addhandler'
Addhandler pCloseCtrl.click, addressof EventHandler(pObj,pArgs)
private sub EventHandler(pobj as object,pargs as eventargs)
'do your code here
end sub
evilnoodle wrote: anonymous function,
don't really know how to do this in vb
But when converting the code using:
http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]
I get:
AddHandler pCloseCtrl.Click, AddressOf Function(pObj, pArgs) Do
If Me.formIsDirty Then
MessageBox.Show("There are unsaved changes, please save the changes before closing.")
Else
pForm.Close()
End If
End Function
Never done it like that tho so don't really know if it works like you want it.
Hope this helps
|
|
|
|
|
Thanks but...
Your second solution is a far miss, VS wont accept that syntax.
The first solution is closer but when I do the EventHandler(pObj, pArgs) I get a compile time error stating that: 'AddressOf' operand must be the name of a method (without parentheses)
When I remove the parenthesis, it works but I get a NullReferenceException on that same line at runtime.
Any ideas?
|
|
|
|
|
evilnoodle wrote: Your second solution is a far miss, VS wont accept that syntax.
Could be didn't really test it its just the code you pasted run thru the converter. (did think it kinda looked strange)
evilnoodle wrote: The first solution is closer but when I do the EventHandler(pObj, pArgs) I get a compile time error stating that: 'AddressOf' operand must be the name of a method (without parentheses)
When I remove the parenthesis, it works but I get a NullReferenceException on that same line at runtime.
Your function (eventhandler) has to take the same parameters as the event it is delcared for (usually it "sender as object, e as eventargs")
so the code becomes
AddHandler frm.Click, AddressOf EventHandler
Private Sub EventHandler(ByVal pobj As Object, ByVal pargs As EventArgs)
'do your code here
MessageBox.Show("test")
End Sub
This works on my end. Can you post your code so I can see what might be wrong.
|
|
|
|
|
Here is what I have so far, I get a NullReferenceException on the AddHandler line.
This is not the same code as the DirtyMarker, but it comes down to the same implementation. This code is supposed to do something when the main form's Datagridview fires userDeletingRow.
Also please ignore the fact that this is a generic type class, I'll focus on that when I get these events to work.
Public Class DataFormLogic(Of T)
Public Sub New(ByRef DGV As DataGridView)
AddHandler DGV.UserDeletingRow, AddressOf MyDelete
'Also tried this, which give a delegate signature error at compile time
'AddHandler DGV.UserDeletingRow, New EventHandler(AddressOf MyDelete)
End Sub
Private Sub MyDelete(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs)
MsgBox("Eureka!!!!!")
End Sub
End Class
-----------------------------------
UPDATE:
I just got it to work with a button on that same form, it must have something to do with the DataGridView... oh how I loathe that control! Could you try to get it going with a datagridview?
modified on Friday, December 5, 2008 3:32 AM
|
|
|
|
|
This works without a problem at my end (see my code below).
My only thought would be that you call this class before the datagridview is created.
The form has a datagridview on it called datagridview1 (original I know)
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dt As new DataTable()
dt.Columns.Add(New DataColumn("Col1"))
dt.Columns.Add(New DataColumn("Col2"))
Dim row As DataRow = dt.NewRow
row.Item("col1") = "col1"
row.Item("col2") = "col2"
dt.Rows.Add(row)
row = dt.NewRow
row.Item("col1") = "col11"
row.Item("col2") = "col22"
dt.Rows.Add(row)
DataGridView1.DataSource = dt
Dim temp As New Class1(DataGridView1)
End Sub
End Class
Public Class Class1
Public Sub New(ByRef dgv As DataGridView)
AddHandler dgv.UserDeletingRow, AddressOf mydelete
End Sub
Private Sub mydelete(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs)
MessageBox.Show("Eureka!!!!")
End Sub
End Class
This works perfectly for me.
When do you create the instance of the class?
|
|
|
|
|
Wow you reply fast, you're either in my time zone, or you never sleep!
That was EXACTLY my problem thank you very much! Funny thing is, I figured it out just before reading this post.
I instanciated the object globally, i.e. before the dataGridView existed, after moving the code to the Load (same as you did) it worked fine!
5!
|
|
|
|
|
evilnoodle wrote: Wow you reply fast, you're either in my time zone, or you never sleep!
A bit off the both (my average sleep a day is around 4 hours)
evilnoodle wrote: thank you very much
Your very welcome, glad to be off help where I can
evilnoodle wrote: I figured it out just before reading this post.
Even better you'll remember it longer that way
|
|
|
|
|
AddHandler pCloseCtrl.Click, AddressOf ClickHandler
Private Sub ClickHandler(pObj As Object, pArgs As EventArgs)
'your code here
End Sub
The current version of VB does not support multiline delegates, so it is not possible to use the anonymous function syntax.
To remove the event, you use the same syntax except you say RemoveHandler instead.
|
|
|
|
|
The entire code snippet converts very well to VB - the conversion is (via Instant VB):
Private Sub test()
AddHandler pCloseCtrl.Click, AddressOf AddressOf AnonymousMethod1
End Sub
Private Sub AnonymousMethod1(ByVal pObj As Object, ByVal pArgs As Object)
If Me.formIsDirty Then
MessageBox.Show("There are unsaved changes, please save the changes before closing.")
Else
pForm.Close()
End If
End Sub
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
Is there any example showing the use of serial port tool which is in the toolbox of vb.net? Don't know how it work even after i went to msdn.
|
|
|
|
|
hi,
You can surely find many online tips for writing the code..i am telling this becoz i am also working exactly with the same what you are expecting..My advice is, try yourself by searching in google so that you will get more ideas.
Regards...
Selva Shankar
|
|
|
|
|
I having some text files in a folder. I want to get all the files name and last modified date. how to get all files name and last modified date.
Jishith
|
|
|
|
|
Directory.GetFiles, from memory, then for each file, you would have to request the fileinfo to get the modified date.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have One listbox in my form. I have to send multiple data from listbox to database as user select one or morethan one value. Also If i click on Refresh button all the selectecd valuue diselect
.
|
|
|
|
|
Refresh button ? Is that part of your question an ASP.NET question ?
If you have to store more than one value, then you need to set up your db to take more than one value for a field, through a joining table, or by storing XML or something.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
nO, tHIS IS NOT A PART OF ASP.NET.
I HAVE A FORM WHERE I HAVE PUT A LISTBOX. IT DEPENDS ON THE USER HOW MANY LISTITEMS HE SELECTS, AND DEPEND ON THAT TRUE VALE I HAVE TO EXPORT THOSE NAME TO DATABASE. IN MAY DATABASE THERE IS ONLY ONE COLUMN FOR THAT FIELD.
I CAN PASS ONE VALUE BUT NOT MORE THAN ONE.
CAN U GIVE SOME CODE TO HELP ME OUT OF THIS PROBLEM.
|
|
|
|
|
I hope the caps lock was an accident - it is rude to yell at someone trying to help.
If you can select many items from a list box and have only one field to store the data it in how do you propose to acheive it?
CG suggested you create a link table which is a standard relational database structure. Or you could store the list as XML in one field (also suggested).
You are not asking a programming question, it is a design issue. Decide on the design and then code it appropriately. If you are looking for code to CRUD the database then you need to look harder, there are many article here which will help you.
[edit]
Ok so you asked exactly the same question earlier about checkboxes, did you think the answer would change for a list box? Listen to what you are being told.
[/edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As Mycroft said, hope the caps lock was an accident. Having the all caps is like shouting.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Yeh, It was by mistake i used the caps lock.
|
|
|
|
|
I have an assignment and I have been trying to get in touch with my professor to no avail. I missed last class and am totally behind. Any help would be appreciated. Here is the programming challenge:
Create an application that simulates a lottery. Should have an array of 5 integers and should generate a random number from 0-9 for each element in the array. The array is permitted to create duplicate values. The user should enter 5 digits which the application will compare to the numbers in the array. A form should be displayed showing how many of the digits matched. If all match, display a form proclaiming the user as the grand prize winner.
Thanx
|
|
|
|