|
Try this :-
Function f(Optional Byval d as Date = nothing) as object<br />
If d = nothing then<br />
d=System.Date.Today<br />
End If<br />
' rest of your code here<br />
End Function
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Thank you , this is what I am doing but this function is a part of a dll that I wrote and it is used by 5 different programmers.
When they used this function then instead of seeing that the optional date is set to today they see that the optional date is set to nothing (#12:00:00#). It is not very elegant for the programmer.
Shay Noy
|
|
|
|
|
Agreed, but I see no other solution. I would suggest that you add a metadata description to the function and detail what will happen if the date passed to the function is nothing.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
|
In works in VB.NET 2005 and 2008. On the line emmediately above the function, sub, property etc type 3 single quotes ie ''' The rest is done for you.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
You right it works if the function, sub , property are as part of the same project. But try to write a dll, add ''' in one of your function and use this dll in one of your applications, it will not work.
Shay Noy
|
|
|
|
|
Then forget the optional parameter and write an overloaded function, one that takes a Date parameter and one that doesn't. In the one that doesn't, you simply declare an internal variable that's set to todays date.
|
|
|
|
|
|
Hi all,
I'm developing an application in VB2005.Net 2.0 and I would like to use a C header file that contains many structs that I need in the project. This structs are going to change quite often so I wouldn't like to migrate the structs from the C file to VB code each time that the header file changes. The best thing for me would be to include the '.h' file directly into my project so I could access it directly.
Is it possible to do it in any way? Could it be possible to do it encapsulating the '.h' file into a library and then reference it from the VB project?
Thanks in advance for any idea you have,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Perhaps if you make a C++/CLI dll, you could do it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I've done it but I just have access to the struct name and not to its subelements. I mean:
In the .h header file:
<br />
....<br />
public struct S_ERRORS{<br />
unsigned char uHall2;<br />
unsigned char uHall1;<br />
}<br />
...<br />
Inside the VB project, I can declare a S_ERRORS variable but I cannot access to its element: uHall1, uHall2
Is there any way to access to this elements?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Marc Soleda wrote: I've done it
Done what?? Did you compile this into a MANAGED (C++ CLI) .DLL or into a normal Windows library .DLL (unmanaged code). If unmanaged, you won't be able to use the structures defined in the .DLL.
|
|
|
|
|
Into a C++/CLI dll: I can declare a structure variable defined in the library but no access to its elements
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
I have a datagrid view which has cell editing enabled.
I have added a button column in the first column.
Now i want that if user edits a row and then wants to cancel the edit on that row he can do that by clicking on that button.
I have tried Canceledit of datagridview but the datatable bind to that datagrid has the changes even after this.
How can i cancel the updates in the grid on click of the button present for every row
|
|
|
|
|
Without seeing the code you're using to cancel the operation, what the data source is, it's kind of difficult to tell. CancelEdit only works if the data source supports the IEditableObject interface and EndEdit must NOT be called between the time the edit is started and the call to CancelEdit.
|
|
|
|
|
Dim dt As New DataTable
Dim ad As New SqlClient.SqlDataAdapter("Select Top 5 * from T010011", "server=.; database=WSS_4;uid=sa;pwd=; current language=us_english")
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cb As New SqlClient.SqlCommandBuilder(ad)
ad.Fill(dt)
DataGridView1.DataSource = dt
DataGridView1.EditMode = DataGridViewEditMode.EditOnEnter
End Sub
Private Sub GlassButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GlassButton1.Click
ad.Update(dt)
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
DataGridView1.Rows(e.RowIndex).Cells(1).Value = My.Resources.top_left_back
End Sub
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
If DataGridView1.Rows.Count > 0 Then
'DataGridView1.Rows(e.RowIndex).Cells(1).Value = My.Resources.top_left_back 'CType(iconColumn, DataGridViewImageColumn)
End If
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If e.ColumnIndex = 0 Then
DataGridView1.CancelEdit()
Else
End If
End Sub
//////////////////////////
A user can edit 10 rows and in the end wants to update only 5 of them so rest he can cancel by clicking cancel button in the Grid.
|
|
|
|
|
Hi All,
I am developing one application with VB 6.0 and MS Access.
I am using the following connection string to connect to database.
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\9.124.124.90\sanramal1\overtime log\Overtime Log\Data\OT_Log.mdb"
In the above I have given the IP address of the system where the database OT_Log.mdb is located.
But I am facing problem that is, Since the IPAddress is dynamic I cannot give the IP address , so I thought of using the MAC Address of the System ( Which is static even the IP address is changed). (Mac Address - Physical Address).
But I dont have any idea how to give the MAC address in the connection string instead of IPAddess.
Or is there any code to recover ip address by giving the mac address.
Please Please help me.
Thanks you all in advance,
Regards
|
|
|
|
|
I would suggest looking into something like DynDNS and using that
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Thanks lot.
Can you give me little more about DynDNS.
Regards,
|
|
|
|
|
Please read the article I link to in my sig.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Can you not use the computer name rather than its IP Address?
e.g.
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\MyDataServer\sanramal1\overtime log\Overtime Log\Data\OT_Log.mdb"
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Hi,
Thanks lot.
Yes I tried by giving the computer name.
But the problem is, when i install it in other's system, in some of the system it is connecting and working fine, but in some system it is not connecting with the system name that I have given in connecting string. It is because those users are in different subnet in network. So who are all in same subnet of the server (That is the system given in connecting string) they can able to connect to the application and work well.
Can you please give me some ideas to overcome this problem. It is really very very urgent.
Thanks lot.
Regards,
|
|
|
|
|
This question was asked and answered before. You have a DNS configuration issue on your network. Only your LAN Admin can fix this problem so that all the machines on the network can resolve the name of the server to it's IP address. This is your ONLY possible solution!
You can NOT use the MAC address in the connection string. The MAC address isn't usable by your code at all. It's a physical layer address used to transmit packets between network cards on the same physical subnet. The MAC is completely meaningless to your application.
|
|
|
|
|
Using VS05
I have a thread pool requirement. I grabbed the threadpool articles by Xiangyang Liu and it was very instructive. However I have large long running processes that are interdependant and all the thread pools seem to be directed at independant, small, high volume processes. Also I cannot use a queue because I need to check for dependancies already in the work list and extract from other than the 1st position. So I intend to use object lists and the RemoveAt method.
Is there a reason to support a minimum number of threads in the pool. I am intending to create a new thread up to the max setting (4 only) and destroy the thread when it is compleated, is this reasonable? Some of the processes take 90 minutes.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: However I have large long running processes that are interdependant and all the thread pools seem to be directed at independant, small, high volume processes
Threads are a division of work, which should, ideally, be divided into small, atomic operations.
Mycroft Holmes wrote: Some of the processes take 90 minutes.
This sounds like a candidate for an entirely seperate process, not a thread out of the pool. But, that depends on the operation. If it's a small operation that just takes a long time, then a thread may work. If it's a long step-by-step, non-repeating operation (many steps to get a job done), a seperate process may be in order.
|
|
|
|