@Pgmer , with due respect sir , i think dataset is like a database having one or more then one tables in it , dataset and datatable are two different things , correct me sir if i am worng .
Best Regards
@Pgmer , with due respect sir , i think dataset is like a database having one or more then one tables in it , dataset and datatable are two different things , correct me sir if i am worng .
Best Regards
well you can do this
'declare the variable name openNumber
'and use this code the form1 button click event
If openNumber <= 2 Then
Form2.Show()
openNumber = openNumber + 1
Else
MsgBox("your limit is ended")
End If
please see the attached file , hope this will solve your issue.
Regards
listen , use same logic as you get from above link , in your user table add a new field called enableStatus set the datatype bit/boolean , now count 3 times wrong input , after 3 times wrong input , update that user and change the enableStatus field false ,
now in your login form where you are validating the username and password you should also validate the enableStatus of that user , if status is false then dont allow user to login even with correct username and password , and now about your question's second part , make a form , place a grid in it . show all usernames and enablestatus in grid and allow admin to change the enable status . hope this will clear your logic , make some efforts . if you got any prob then i will try to provide a sample solution to demonstrate all this .
Best Regards
Sir , i just give some suggestions so that he can better analyse his requirement and adopt best solution for his prob :)
Best Regards Sir
hello!
you can save value of radio button by using radiobutton1.checked , and as you have prob which radio button is selected by the user , then there are two ways to perform this ,
1- you can use two fields in your database , male and female , because radio button always provide yes or no values or true or false values , so if you used single field name gender then there will be prob .
2- you can set the datatype of your gender field varchar or string , and at the coding end you can do this
if radiobuttonMale.checked = true then
'you enter in your database word male as string
else
'you enter in your database word female as string
end if
and there is another way to do this , use combo box , set two values , male and female , now in your database you have a single field name gender , set datatype varchar or string , and save the selected value in your database . like this combobox.text.
and in last in your code there is no column is define for your gender insertion ,
please recheck your code again :)
Best Regards
sorry :P
i typed wrong , this is the correct code
dim con as new sqlconnection("connectionstring")
con.open()
dim da as new sqldataadapter("select * from table",con)
dim dt as new datatable
da.fill(dt)
datagridview1.datasource = dt
try this
hello !
try this code , hope this will solve your prob.
Sub values()
Dim con As New SqlConnection("connectionstring")
con.Open()
Dim da As New SqlDataAdapter("select name , idno from students", con)
Dim dt As New DataTable
da.Fill(dt)
ComboBox1.DataSource = dt
ComboBox1.DisplayMember = "name"
ComboBox1.ValueMember = "idno"
End Sub
'-----------------
'use this code at the selectedindex change event of your combobox
'-----------------
TextBox1.Text = ComboBox1.SelectedValue.ToString()
Regards
please check this thread , hope you will find any idea ,
http://www.daniweb.com/software-development/vbnet/threads/412558/1761197#post1761197
Regards
please start new thread sadia , in it discussion forum ,http://www.daniweb.com/community-center/it-professionals-lounge/5 here is a link of it , post your question there ,hope so you will find some helpful tips.
Regards
well please try this code
dim con as new sqlconnection("connectionstring")
con.open()
dim da as new sqldataadapter("select * from table",con)
dim dt as new datatable
Date.fill(dt)
datagridview1.datasource = dt
this will solve your prob :)
Regards
@Lusiphur thanks sir for taking interest , the solved thread you mentioned where i posted is just after 2 , to 3 mint , because i was working on his/her prob and when i find the answer then i posted there . as i also mentioned in my post that event this thread is solved , http://www.daniweb.com/software-development/vbnet/threads/415886/page2 this is the link of that post , and also i wont ask any question in any thread , if had then i asked it in my own thread ,
and thanks all of you who posted here , thanks for you valuable time and comments :) thread is solved.
Best Regards
hmmm , you are right it means nothing to me , but it really make my day sad :(
well , please check your database column names and columns names in your code , and match them , i hope prob will solved , please check them carefully .
Regards
farhan please use this code , as i assume that enable_flag is bit in your db .
Try
Dim con As New SqlConnection("conn-string")
Dim cmd As New SqlCommand
con.Open()
cmd.Connection = con
cmd.commandtext =
"UPDATE cg_security_user_right SET user_id=@user_id, right_id=@right_id ,enable_flag=@enable_flag WHERE user_id= " & tuser.Text & "and right_id = " & tright.Text & " and enable_flag = " & CheckBox1.checked & ""
cmd.Parameters.AddWithValue("@user_id", txtuserid.text) 'user val(txtuserid.text) if userid is integer
cmd.Parameters.AddWithValue("@right_id", txtrightid.text) 'user val(txtrightid.text) if userid is integer
cmd.Parameters.AddWithValue("@enable_flag", checkbox1.checked) 'i assume that you have a chk box
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(Err.Description)
End Try
hope this will works fine
@Mitja Bonca sir, with due respect you are giving wrong code , please check again ,
can you please tell me about this field enable_flag what is this , what is the datatype of this field ?
well i think what you done is you select your VLC component by right click --->choose item --- com component , and then you select your required com components , ? if yes then go back to your com component menu you will find 2nd column name path in your com component window , you select you required component and get path you will find a file having extention .dll , search that file and add it in you project , then compile it and again make a setup , hope it will work fine :)
yes , sorry i just not read your code carefully , use this code
Try
Dim con As New SqlConnection("conn-string")
Dim cmd As New SqlCommand
con.Open()
cmd.Connection = con
cmd.commandtext =
"UPDATE cg_security_user_right SET user_id=@user_id, right_id=@right_id ,enable_flag=@enable_flag WHERE user_id= " & tuser.Text & "and right_id = " & tright.Text & " and enable_flag = " & CheckBox1.Enabled & ""
cmd.Parameters.AddWithValue("@user_id", txtuserid.text) 'user val(txtuserid.text) if userid is integer
cmd.Parameters.AddWithValue("@right_id", txtrightid.text) 'user val(txtrightid.text) if userid is integer
cmd.Parameters.AddWithValue("@enable_flag", checkbox1.checked) 'i assume that you have a chk box
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(Err.Description)
End Try
hmmm , well i dont know what you have done so far but here is a sample code , try to make is workable for you ,
consider we have values in grid , we have two columns , userid , date , now do this
dim i as integer
for i = 0 to datagrid.rows.count -1
if datagrid.item(1,i).value.tostring() < now.date.tostring() then
msgbox("you are trying to save records of past date.")
else
'allow user
end if
next
in else section you can code your insertion coding , hope this will helps you if no then please write some code , if you got any error then we are here to solve them :)
Regards
please use this code :)
Try
Dim con As New SqlConnection("conn-string")
Dim cmd As New SqlCommand
con.Open()
cmd.Connection = con
cmd.commandtext =
"UPDATE cg_security_user_right SET user_id=@user_id, right_id=@right_id ,enable_flag=@enable_flag WHERE user_id= " & tuser.Text & " right_id = " & tright.Text & " enable_flag = " & CheckBox1.Enabled & ""
cmd.Parameters.AddWithValue("@user_id", txtuserid.text) 'user val(txtuserid.text) if userid is integer
cmd.Parameters.AddWithValue("@right_id", txtrightid.text) 'user val(txtrightid.text) if userid is integer
cmd.Parameters.AddWithValue("@enable_flag", checkbox1.checked) 'i assume that you have a chk box
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(Err.Description)
End Try
Best Regards
well bro do this
if datagrid.item(columnindex,rowindex).value.tostring() < now.date.tostring() then
msgbox("you are trying to save records of past date.")
else
'allow user
end if
you are using loop to insert your data ? if you find any prob then please post your insertion code here.
Best Regards
thanks for the reputation :P , i was sad because some one vote me down twice :P thanks
you always welcome :),bro
we can not do anything with our life , but people who are managing this site , can do something , as we can not give reputation with out giving any reason , they can make it possible with down vote also .
yes farhan , these are variables , you can replace with them with your controls like this
username = @username
'--------------
username = txtusername.text
i can better help you if you provide some more code :)
hello !
well today i got two down votes , i dont think that there is any thing wrong with my post , as we know who add reputation to us , can we know the person who is down voting us , and is there any way to balance them , well this thing make me feel very bad , i always tried to help others and to share my knowledge and to learn something new from you experienced people.but this thing is very bad , :( , i spend lots of time when someone post a question to answer him , am i doing all this to get down votes :( ,
Regards
why some one down vote my post :-X with out any reason :-| , this is not fair :(
why some one down vote my post :-X with out any reason :-| , this is not fair :(
is there any column of date ?
ok lets assume you have a form , have so many controls , and a datetimepicker , now you want to save records of the current date , and restrict user to save records of past date , then you can do like this .
if datetimepicker.value.date.tostring() < now.date.tostring() then
msgbox("you are trying to save records of past date.")
else
'allow user
end if
Regards
hello !
check this
"UPDATE cg_security_user_right SET user_id=@user_id, right_id=@right_id ,enable_flag=@enable_flag WHERE LastName= " & tuser.Text & " right_id = " & tright.Text & " enable_flag = " & CheckBox1.Enabled & ""
'@name they are the variables and you can also replace them with you textboxes or using command parameters to give values.
Reagrds
well do like this
'declare the variable
dim myname as string
'now use this code at the button click event
myname = yourbutton.Name.ToString
msgbox(myname)
Regards
i think you should set your application form prop , show in task bar = false ,then use this code at the closing event of your form
System.Diagnostics.Process.Start("shutdown", "-s -t 00")
this will shutdown the computer when somebody close your application , then when you built your application then also add shortcut to startup folder , so that when computer starts your application also starts.
Regards
you want to show the name of button or caption/text of button in msgbox when you click it ? please rephrase it .
hello !
i know this thread is solved , but please also check this
Imports System.IO
' make a reference to a directory
Dim di As New IO.DirectoryInfo("c:\")
Dim diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo
'list the names of all files in the specified directory
For Each dra In diar1
ListBox1.Items.Add(dra)
Next
Regards
i think you have to include dll files in your project , not only reference of those files.
Regards
hello!
you can do like this
dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataapter("select * from foods where foodtype='"&combo.text&"'",con)
dim dt as new datatable
da.fill(dt)
gridview.datasource = dt
con.close()
use this code at the button click event you will find all the records of the selected type , and if you want to populate your combo also then use this code at the load event of your form
dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataapter("select foodType from foods",con)
dim dt as new datatable
da.fill(dt)
Combo.datasource = dt
combo.displaymember = "foodType"
con.close()
Regards
i think you want that your combo will show values without pressing a button ? , if yes then just call the code at the load event of your form , or you can also use this code at the combo's got focus event , so when you got focus at combo then it will show your records , if i am wrong then please describe your requirement , and prob .
Regards
well you can also try a timer for this , if you use timer then also there is no need to press a button .
Regards
please use this code , if this time you got any prob then next time i will post the example solution , :P
Sub values()
Dim con As New SqlConnection("Data Source=waqas\sqlexpress2;Initial Catalog=myDB;Integrated Security=SSPI;")
con.Open()
Dim da As New SqlDataAdapter("select name , idno from students", con)
Dim dt As New DataTable
da.Fill(dt)
ComboBox1.DataSource = dt
ComboBox1.DisplayMember = "name"
ComboBox1.ValueMember = "idno"
End Sub
well you are using long code. please try this
dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataadapter("select field1,field2 from table1",con)
dim dt as new datatable
da.fill(dt)
combobox1.datasource = dt
combobox1.displaymember = "field1"
combobox1.valuemember = "field2"
con.close()
this will solve your prob :)
Regards
just change this
Dim command As OleDb.OleDbCommand
'with this
Dim command As new OleDb.OleDbCommand
Hope this will solve your prob :)
Regards
please post your full code , so that we can help you.
well once i made my youtube player , for that i used shockwave players .but when i tried to play video at another computer then it was not working , then i installed a shockwave player in that pc and my application run successfully . i have no idea that what component you have to install in others pc . may be a vlc player. just an idea
Regards
congratulation ,on your completion of second project :) ,
Regards
thank you happygeek , :) for your kindness and valuable time .
Stay Blessed.
Thread is solved.
hello !
is there any way to complaint against any user . if yes then how ?
Regards
in single thread you have to just discus your single issue ,but if you just make a single thread open through out your prob you will face in your project then it is not a good practice , as i am not a moderator , but it is the way to discus your prob in any online community .
Regards
YOUR PK is auto incremented by the database ?
please check this link , hope you will find your ans.
http://aspadvice.com/blogs/rjdudley/archive/2005/05/18/2591.aspx