|
|
hi,
i used your link sample, but i was got this error
Value cannot be null.
Parameter name: ptr
FYI: Please download my sample project from this link <a href="http://www.2shared.com/file/4835939/1eaac353/RunTime_Dll.html">http://www.2shared.com/file/4835939/1eaac353/RunTime_Dll.html</a>[<a href="http://www.2shared.com/file/4835939/1eaac353/RunTime_Dll.html" target="_blank" title="New Window">^</a>]
Note: Please send me any sample project attachment to my email id (to_velu@yahoo.co.in) if possible.
|
|
|
|
|
Download link
http://www.2shared.com/file/4835939/1eaac353/RunTime_Dll.html
|
|
|
|
|
The method you are using (and was suggested in my link) works for ActiveX Dlls and OCX objects.
First, have your class library a module not a class:
Public Module TestDll
Public Sub Test()
MsgBox("Hi")
End Sub
End Module
Then use LoadLibrary to load the dll.
Delegate Sub Tst()
.
.
.
Static dll_loaded As Boolean, dll_handle As Int32, fn As tst
dll_handle = LoadLibrary("Testdll.dll")
msgfn = GetProcAddress(dll_handle, "Test")
msgfn.Invoke()
By the way, why do you want to late-bind?
Try using
Declare which makes it much faster and more reliable!
|
|
|
|
|
I believe you need to read up on Late Binding[^]
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi,
What would you think if the listview is not showing the Turkish characters in the rows after placing a splitter container and moving listview into splitter's one side panel and setting the fonts same for both controls. This problem turned in to a disaster for me. Eventough I used UTF encoding to the strings the problem haven't changed.
Here how I tested the problem to make sure the turkish characters were diplayed in the listview properly.
I created a new form and placed a listview with one column and then I listed the file mames which contained some turkish characters in this column. It showed perfectly. However, after adding a splitter container control on to form and moving listview inside of this container and adding a few more columns to listview did start not showing the Turkish characters anymore in the listview but strange characters.
Now I wonder what would you think about such problem and how to solve it?
Thanks for reading.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Recheck the properties of your ListView. It is possible that 1 or more have reset to the defaults, when you moved the ListView control into the splitter
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
The problem remains the same I have checked to see if any property attribute set to default.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hi,
How could you determine if a read item is a folder or a file in vb.net? For an instance I have read all the files under directory. At the same time there is a sub directory under the directory and I want to get its type.
Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
modified on Sunday, February 8, 2009 1:54 PM
|
|
|
|
|
Hi,
File attributes would tell you. Here is a C# example, I don't have it in VB.NET:
FileInfo info=new FileInfo(fileName);
attributes=info.Attributes;
bool isFolder=(attributes & FileAttributes.Directory)!=0;
...
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
The equivalent vb code is:
<code>
Dim info as New FileInfo(fileName)
Dim isFolder As Boolean = info.Attributes And FileAttributes.Directory
</code>
|
|
|
|
|
If IO.File.Exists(Path) Then
'It is a file
ElseIf IO.Directory.Exists(Path) Then
'It is a folder
End If
|
|
|
|
|
I'm using vb.net application form
My form requests user to enter ID in text area to retreive some data for printing
I want to know is it possible to pass this ID as a paramter when I call the web application form without requesting user to submit it I mean that I will send user link of the application form with the ID as a parameter just as we do in a web form.
|
|
|
|
|
Naglaa Saeed wrote: I mean that I will send user link of the application form
Your question doesn't make sense. There's no such thing. You cannot instantiate, or call, a windows form from a URL, at least, not in the way you're implying.
Are you asking how to call a windows form from a web form?? Or, forgetting the web analogy, are you asking how to pass a username to a login form and execute the code on the login form, without the user typing the information into the form??
|
|
|
|
|
You can use Parametrized constructor or Property if you want to pass a parameter from one Form to another.
Naglaa Saeed wrote: I will send user link of the application form with the ID
In this case, you can use start your application with commandline argument. In main method check the argument and set the value accordingly.
|
|
|
|
|
If I have understood you correctly, you might use commandline parameters to run your application, or as mentioned by crudeCodeYogi, by using parametrized constructors.
|
|
|
|
|
Hi,
I am Using MS Access 2002 Databe & vb.net 2005 in my Project.
In My Project is Select Command working Properly, But Insert & Update Command is giving Error ("Syntex Error in Update Statement" or in Insert Error in Insert Statement.
I am using this function for update
Private Function UpdateUser(ByVal Password As String, ByVal UserID As Integer)
Try
Dim strcmd As String = "update tblLogin set Password='" + Password + "' where UserID =" & UserID.ToString
Dim cmd As New OleDbCommand(strcmd, con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error Message")
End Try
Return 0
End Function
What is the solution for this
Plese Help Me.
Thanks & Regards
Form :-
Vikash Yadav
|
|
|
|
|
Hi,
AFAIK if your UserID field is a string type (which your use of ToString suggests), you must enclose the value in quotes wihtin your SQL statement.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks For Sugestion.
UserID field is a autonumber type. This Function Work with SQL 2000 Properly. I want to use Access DataBase not SQL.
Thanks & Regards
Form :-
Vikash Yadav
|
|
|
|
|
Instead of using string concatenation to build the SQL statement, use parameterized queries instead. Search the articles for "SQL Injection" for examples and why it is a VERY good idea to do so. Your code, as it is now, is very broken, even though it "works".
|
|
|
|
|
Why is his code "very broken" from a "SQL Injection" standpoint? He is working with an Access MDB, and even if his UserID was being passed as a string, you can not concatenate queries in Access, so that does not seem to be an "injection" concern. And, since UserID is actually being passed as an integer, I do not see how a nefarious user would be able to sneak an 'Or' conditional into the where command that will automatically make the result True. What is the 'SQL Injection' issue I am missing in his query?
The potential problem I see with this code is that if 'Password' can contain single quotes, he is not escaping those single quotes in the query being built, and that would create a syntax error. Now parameterized queries would resolve that potential issue, but that can also be handled easily with a Replace statement, and without the use of parameterized queries.
|
|
|
|
|
paas wrote: if his UserID was being passed as a string, you can not concatenate queries in Access
Excuse me, but what do you think he was doing in his code? That is EXACTLY string concatentation, building a query by piecing together strings! And YES, this is a HUGE injection concern. There data being fed is is, most likely, not being scrubbed, so it cannot be trusted to get copied directly into an SQL query.
And I suggested searching the articles for "SQL Injection" because there is a very good article on SQL Injection attacks AND, at the point of the question, it shows many examples of using parameterized queries.
paas wrote: And, since UserID is actually being passed as an integer, I do not see how a nefarious user would be able to sneak an 'Or' conditional into the where command that will automatically make the result True.
The UserID was being passed in as an integer, but, if you go back to his posted code, the password was not. What is the password entered started with a "'" character?? I'll leave it up to you to do the very same search I told the OP to do, and read the articles as to why this is a very bad practice.
paas wrote: but that can also be handled easily with a Replace statement, and without the use of parameterized queries.
An insufficient technique that only targets a single attack. This is another bad technique that employs the equally bad philosophy of "enumerating badness". Google that little phrase and you'll see what I mean.
|
|
|
|
|
How I can Use use parameterized queries.
This Query Which i am Useing That is workin with SQL Databse, But not with Acces Database, With Access Database Only Select Query is Running, Not Others.
When Programe is gon on cmd.ExecuteNonQuery() then give ERROR "Syntax Error in Update Statement"
Thanks & Regards
Form :-
Vikash Yadav
|
|
|
|
|
Well, there's nothing obviously wrong with the syntax, unless your database have the proper table and field names to match what's in the statements. You may want to try replacing the single quotes (') in the statement with double quotes (") and verifying the table and field names.
|
|
|
|
|
Dave is right,with the code like this you will be exposed to SQl Injection.
When i installed VS i did not install VB.NET , so i will try to show you how to do it i C# you can easly convert it to vb.net
first you need to create a Stored Procedure like this
Create PROC prc_Update
(
@Password varchar(40),
@UserID int
)
AS
Update tblLogin
set Password=@Password
where UserID =@UserID
now regarding the ID, you must find another way, mybe use a username,but you have to make sure there is no Duplicate username because you might end up updating wrong records
and your C# or VB.NET should look like this
String strcon = ConfigurationManager.AppSettings.Get("MYConnectionstring");
SqlConnection con;
SqlCommand cmdupdate;
public int Update_Password(String Password,int id)
{
con = new SqlConnection(strcon);
cmdupdate = new SqlCommand();
cmdupdate.CommandText = "dbo.prc_Update";
cmdupdate.CommandTimeout = 0;
cmdupdate.CommandType = CommandType.StoredProcedure;
cmdupdate.Parameters.Add("@Password", SqlDbType.VarChar, 40).Value = Password;
cmdupdate.Parameters.Add("@UserID", SqlDbType.Int, 4).Value = id;
cmdupdate.Connection = con;
int Results = 0;
try
{
con.Open();
Results = cmdupdate.ExecuteNonQuery();
}
catch (SqlException)
{
throw;
}
finally
{
con.Close();
}
return Results;
}
Lastly you must stop feeding the database wrong info.The Data types and demension should be the same and you will not have any Problems
Hope you get an idea
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|