|
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
|
|
|
|
|
sir i started a voluntary blood donors information service. im in need of an application with which i can maintain the database.so can anyone of you make it for me? i will be very thankful to you. the application must contain following fields.
Donor ID
Donor Name
Blood group (must be like a drop down menu with blood groups)
Address
Last blood donated date
phone no
mobile no
date of birth
and in the application there should be a search button with which i can search for a person with a particular blood group.and it must contain add, edit, save, print and delete fields.
please can anyone do this for me....my work will be a bit faster with this one. the application must be simple without installing any extra softwares like dot net,ms access, sql, etc,.
thanks in advance.
regards,
Neetu.
|
|
|
|
|
People are here happy to help if you are stuck in somewhere while developing but nobody is free to give you the source code or write a whole application for you. If you need such service you can ask this[^] and this[^] people.
By the way why don't you start the project by yourself and if you are stuck then you can always comeback and ask here.
|
|
|
|
|
hi thank you so much for the suggestion.even I'm tired of asking people who are great programmers about my little application.but they dont have any time for this small one. so I was thinking of learning visual basic and prepare a good small application for myself. as I'm a beginner if I get any doubts will surely ask you people.
thank you.
|
|
|
|
|
If you concider .NET to be excess software, you're in the wrong forum :P
|
|
|
|
|
neetu149 wrote: sir i started a voluntary blood donors information service
I hope that doesn't mean you're collecting blood with the competence you're showing here.
I am assuming you have the best of intentions ( that is, that you're trying to create something for a free service, and that this is why you're in over your head ). However, no-one is going to write this for you, and statemetns like:
neetu149 wrote: . the application must be simple without installing any extra softwares like dot net,ms access, sql, etc,.
show that you are really very lost.
1 - you cannot write a VB app without .NET
2 - you need a database for what you're doing, and SQL Server Express is free.
I suggest if you're serious that you buy a book driven to data centric development in .NET and work through it. If you ask specific questions, we'll be more than happy to help you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote:
I hope that doesn't mean you're collecting blood with the competence you're showing here.
For the win!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|