hello!
you can use this code at the click event of the listbox
button1.enable= true
hello!
you can use this code at the click event of the listbox
button1.enable= true
hello LearnVBnet!
i read this thread more then 5 times , but i still not able to understand what is your question "How to NoT In Paylist LvList where InvNomer have add to dgv Payment
Not Display InvNomer in LvList Paylist where InvNomer in Dgv Payment." this the description of your prob ,please provide some explanation so that any one can help you in a good way ,
well as i understand that you have a list box and a grid , you want to remove all the items from the list view those are present in a grid view ,if this is your prob then try to use this code , hope this will solve your prob .
Dim i As Integer
Dim x As Integer
Dim find As Boolean
Dim rec As New ArrayList
For i = 0 To ListBox1.Items.Count - 1
find = False
A = ListBox1.Items(i).ToString
For x = 0 To DataGridView1.Rows.Count - 1
B = DataGridView1.Item(0, x).Value.ToString
If A = B Then
find = True
Exit For
End If
Next
If find = True Then
rec.Add((ListBox1.Items(i)))
End If
Next
Dim ab As Integer
For ab = 0 To rec.Count - 1
ListBox1.Items.Remove(rec.Item(ab))
Next
and if this is not the answer of your prob then please rephrase your question.
Regards
hello !
i have no idea how to deal with ms access , but here is a code to insert image in mssql , may be this will give you any idea .
'use this code where you are assigning the values in you command
SqlParameter("@picture", SqlDbType.Image)).Value = arrimage)
Dim myFile As String = picture
If picture.ToString.Length <= 1 Then
Me.myCmd.Parameters.Add("@Picture", SqlDbType.Image).Value = Convert.DBNull
Else
Dim myStream As FileStream = New FileStream(myFile, FileMode.Open)
Dim myImageBuffer() As Byte = New Byte(myStream.Length) {}
myStream.Read(myImageBuffer, 0, myStream.Length)
Me.myCmd.Parameters.Add("@Picture", SqlDbType.Image).Value = myImageBuffer
myStream.Close()
End If
'and this code is for binding picture box with you sql db
dim con as new sqlconnection("string")
con.open()
dim da as new sqldataadapter("select mypic from table1",con)
dim dt as datatable
da.fill(dt)
picturebox1.databinding.add("image",dt,"mypic",true)
'this code will show your saved pic from mssql to your picture box ,
i know this is not what you are looking for , but this will give you an idea to solve your prob:) .
Regards
you can do this by using query , can you please tell me about table and fields and on which fields you want to set you record selection criteria .
Regards
hello !
if you want to bind combobox then try this
dim con as new sqlconnection("string")
con.open()
dim da as new sqldataadapter("your sql query",con)
dim dt as datatable
da.fill(dt)
'now here you can bind your combobox
combobox.databinding.add("selectedvalue",dt,"your database field name",true)
'combobox.databinding.add("selectedvalue",dt,"CityID",true)--like this
If this code solve your prob then please mark your thread solved :)
Regards
if you want to update records of images in single table then use loop and if you want to update records of images in multiple tables then it is better to use stored procedures or if you dont know about stored procedure then use multiple update statements to update your records.(please always provide enough description of you prob so that any one can help you.)
Regards
i dont know which fields you are taking in grid , lets consider if there is a table name student , having ids , stuid , stuname , stufathername ,stuphonno, now you are showing stuname , stufathername,stuphone in grid and want to do same as you mentioned above then you can write this code for selection.
dim myCmd as string
myCmd = "select * from persons where stuname='"datagridview1.item("StuName",datagridview1.currentrow.index).value.tostring &"' and stufathername= '"& datagridview1.item("stufathername",datagridview1.currentrow.index).value.tostring&"' and stuphoneno='"&val(datagridview1.item("stuphone",datagridview1.currentrow.index).value.tostring &"'"
Regards
skp03 hello !
i have an idea , may be this will help you , why not you use clipboard . like this
'place a timer on application1 then place this code on every tick event
TextBox1.Text = My.Computer.Clipboard.GetText.ToString
'the code which is copy by the user will auto paste in textbox1 .
i know this is not what you are looking for . but this is what i can do for you right now :),may be this will give you any idea.
Regards
hello!
how can this code update database :P you are using select statement instead of update :)
Regards
Hello !
i watched this given video . it is very simple i write this code right here so there may be some spelling mistake in it. check this out
dgvTableList---is a grid which will show tables of selected database
dgvAllRecords---it will show all records of the selected table
'first import these
'--------------------------------------------------------------------
Imports System.Data.OleDb
import system.data.sqlclient
'--------------------------------------------------------------------
'use this code at the connect button .
if combobox.text = "System.Data.OleDb" then
Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&txtserver.text&";User Id="&txtuserid.text&";Password="&txtpassword.text&";")
Dim cmd As OleDbCommand = New OleDbCommand("Select Name from MSysObjects", con)
con.Open()
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
dgvTableList.DataSource = myDataSet.Tables("MyTable").DefaultView
con.Close()
end if
if combobox.text = "system.data.sqlclient" then
Dim con as new sqlconnection("Data Source="&txtserver.text&";Initial Catalog="&txtdb.text&";User Id="&txtuserid.text&";Password="&txtpassword.text&";")
con.open()
dim da as sqldataadpter("Select name from sys.tables",con)
dim dt as datatable
da.fill(dt)
dgvTableList.datasource = dt
con.close()
end if
'place this code on the double click event of your dgvTableList
if combobox.text = "System.Data.OleDb" then
Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&txtserver.text&";User Id="&txtuserid.text&";Password="&txtpassword.text&";")
Dim cmd As OleDbCommand = New OleDbCommand("Select * from " & dgvTableList.item(0,dgvTableList.currentrow.index).value.tostring , con)'u can use the name of you column in place of 0 (column index)
con.Open()
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
dgvAllRecords.DataSource = myDataSet.Tables("MyTable").DefaultView
con.Close()
end if
if combobox.text = "system.data.sqlclient" then
Dim con as new sqlconnection("Data Source="&txtserver.text&";Initial Catalog="&txtdb.text&";User Id="&txtuserid.text&";Password="&txtpassword.text&";")
con.open()
dim da as sqldataadpter("Select * from " & dgvTableList.item(0,dgvTableList.currentrow.index).value.tostring ,con)'u can use the name of …
hello!
i am working on a Asp.net project using C#, now i want to connect mssql server 2008 using JS or AJAX , i am very new with JS so i have no idea where to start .can anyone help me in this .
Regards
M.Waqas Aslam
hello !
check this code this will show some records in datagrid and some of them in textboxes as you mentioned in your snap shoot.
dim con as new sqlconnection("connection string")
dim da as new sqldataadapter("select * from table or your query",con)
dim dt as datatable
da.fill(dt)
'take a bindingsource
bindingsource1.datasource = dt
'and if you want to see all the records one by then then you can use binding navigator for it like in this way
'--------------------------------------------
bindingNavigator.datasource = bindingsource1
'--------------------------------------------
datagridview1.datasource= bindingsource1
with datagridview1
.column(0).visible = false ' here you can give index of the field you dont want to show in grid and also you can give the column name in place of 0 like this column("recordid").visible= false
.
.
.
.
end with
'now here bind your textboxes
txt1.databinding.add("text",bindingsource1,"fieldname of db",false)'now here you bind your textboxes ,if you want to bind combobox then write selectedvalue in place of text and change false to true.
'bind all you textboxes like this .
Hope this will solve your prob , or give you some idea.
Regards
hello !
please check this link may be it will solve your prob :) http://p2p.wrox.com/sql-language/12823-convert-null-string-concatenation.html
skp03 , can you please post some of your code or snap shoots of your forms so that i can better ans you . and if you are working in C# then it is better to post this question in C# forum so that someone can better answer your prob.
Regards
Please explain your question .this is not the right way .:-|
check this , may be it helps you
dim myCon as new sqlconnection("your connection string")
dim cmd as new sqlcommand
myCon.open()
cmd.connection=myCon
cmd.commandtext="insert into tablename (field1,field2,field3) values (@field1,@field2,@field3)"
cmd.parameter.add("@field1",______).value = txtvalue1.text 'in place of ___ write datatype of your field in your db.
cmd.parameter.add("@field2",______).value = txtvalue2.text
cmd.parameter.add("@field3",______).value = txtvalue3.text'if you have datatype of your field in your db is int , decimal , bigint, etc then use val(txtvalue.text)
cmd.executenonquery()
myCon.close
Regards
nice ans hericles :)
hello ! you can do it like this
'first import system.data.sqlclient then
dim myCon as new sqlconnection("your connection string")
dim cmd as new sqlcommand
myCon.open()
cmd.connection=myCon
cmd.commandtext="insert into tablename (field1,field2,field3) values (@field1,@field2,@field3)"
cmd.parameter.add("@field1",______).value = txtvalue1.text 'in place of ___ write datatype of your field in your db.
cmd.parameter.add("@field2",______).value = txtvalue2.text
cmd.parameter.add("@field3",______).value = txtvalue3.text'if you have datatype of your field in your db is int , decimal , bigint, etc then use val(txtvalue.text)
cmd.executenonquery()
myCon.close
this will insert your data in your table . well i write this code here , so may be there are some spelling mistakes , check them by your own self .
If your prob is solved please mark this thread solved .
Regards
in above code we use selected value from the cell of the grid to get all the records of that selected value ,now what is your question please rephrase it .so that i can help you in better and effective way
Regards
i cant get your point , i think you want to select all records from persons table of selected person id in grid , if i am wrong then please correct me , well for simple select case you can do like this
dim myCmd as string
myCmd = "select * from persons where personID=" val(datagridview1.item("Personid",datagridview1.currentrow.index).value.tostring)'you can use index of your column in place of "personid".
this will select all the records from the table persons of selected personid
Regards
you can set your column readonly property true .
Regards
right click on your project in your solution window , then select ADD ---> Existing Item--->Browse and select your report then press ok . your report will include in your project ,or in order to add new report item then right click on your project in your solution window , then select Add Component--->select crystal report item and press Ok
Regards
first install sql server management studio , then make sure server computer is connect with your computer , then give that server name like server/sqlexpress , then connect it ,
try some other reporting tools , like telerik is one of the best reporting tool now a days ,and you can get full support from here www.telerik.com
Regards
yes , because for receipts we use reports , you can use any reporting tool , this will error free , fast and handsome approach .
your given proj is not working at my end and it gives an error when i run it .you should use break points in your code to solve this type of issues .please in order to get help , post your code or again give new link of working project
regards
Check this Out , May be this will help you :)
try this code
'use this code on the keydown event of the listbox
If e.KeyData = Keys.Down Then
ListBox1.SelectedItem = ListBox1.Items(0)
End If
If e.KeyData = Keys.Up Then
ListBox1.SelectedItem = ListBox1.Items(0)
End If
Hope this helps you
Regards
yes it is possible , but can you tell me what you want to print ,every time before printing you want to change amount , and name ,which is not a good approach. as you said that you want to print a payment receipt you can do like this
' Make a new Form, add the following controls
'Button - btnPrint
'PrintDocument - prnDoc
'TextBox - txtNotes
Dim StringToPrint As String
'This variable will hold the text to be printed and is assigned in the button press event before the printing is called.
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
StringToPrint = txtNotes.Text
prnDoc.Print()
End Sub
'Actual printing code is done by overiding the printpage method of the PrintDocument object. This function will have codes to print the content of the textbox without breaking and spreading out of the page.
Private Sub prnDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles prnDoc.PrintPage
Dim numChars As Integer
Dim numLines As Integer
Dim stringForPage As String
Dim strFormat As New StringFormat()
Dim PrintFont As Font
PrintFont = txtNotes.Font
Dim rectDraw As New RectangleF(e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Width, e.MarginBounds.Height)
Dim sizeMeasure As New SizeF(e.MarginBounds.Width, e.MarginBounds.Height - PrintFont.GetHeight(e.Graphics))
strFormat.Trimming = StringTrimming.Word
e.Graphics.MeasureString(StringToPrint, PrintFont, sizeMeasure, strFormat, numChars, numLines)
stringForPage = StringToPrint.Substring(0, numChars)
e.Graphics.DrawString(stringForPage, PrintFont, Brushes.Black, rectDraw, strFormat)
If numChars < StringToPrint.Length Then
StringToPrint = StringToPrint.Substring(numChars)
e.HasMorePages = True
Else
e.HasMorePages = False
End If
End Sub
hope this will helps you :)
Regards
use this code to save pic
'use this code instead of this code ( cmd.Parameters.Add(New SqlParameter("@picture", SqlDbType.Image)).Value = arrimage)
Dim myFile As String = picture
If picture.ToString.Length <= 1 Then
Me.myCmd.Parameters.Add("@Picture", SqlDbType.Image).Value = Convert.DBNull
Else
Dim myStream As FileStream = New FileStream(myFile, FileMode.Open)
Dim myImageBuffer() As Byte = New Byte(myStream.Length) {}
myStream.Read(myImageBuffer, 0, myStream.Length)
Me.myCmd.Parameters.Add("@Picture", SqlDbType.Image).Value = myImageBuffer
myStream.Close()
End If
regards
See if this helps.
New.Project, 3.Buttons, 3.Panels(view attached image)Public Class Form1 Private pnTemp As Panel, iSelPanel As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click pnTemp = Panel1 '// pnTemp, just easier to work w/. :) If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click pnTemp = Panel2 If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click pnTemp = Panel3 If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp) End Sub #Region "-----===-----===-----===-----===-----=== ===-----===-----===-----===-----===-----" Private Sub collapsePanel(ByVal selPanel As Panel) With selPanel.Name iSelPanel = CInt(.Substring(.Length - 1)) '// get # at end of Panel.Name. End With For i As Integer = 0 To selPanel.Height '// loop from 0 to panel.height selPanel.Height -= 1 '// ...and reduce height. For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3} '// loop thru all btns and panels. If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > iSelPanel Then '// check if # at end of btn/panel is greater than the selectedPanel. ctl.Top -= 1 '// move btn/panel up. End If Next Next End Sub Private Sub expandPanel(ByVal selPanel As Panel, Optional ByVal iPanelHeight As Integer = 125) With selPanel.Name iSelPanel = CInt(.Substring(.Length - 1)) End With For i As Integer = 0 To iPanelHeight selPanel.Height += 1 For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3} If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > …
what :o , i tested it and then i post this code here , i just again use above mentioned code and if work fine for me , ok here is a sample program which i code for you , hope this time it works for you :)
hello
Use this code , hope this will solve your prob
dim mycon as new sqlconnect("connection string")
mycon.open()
dim da as new sqldataadapter("ur selection query",mycon)
dim dt as datatable
da.fill(dt)
'take binding source
bindingsource.datasource = dt
datagride.datasource = bindingsource
'now here you can bind your controls
txt1.databinding.add("text",bindingsource,"field",false)
combobox.databinding.add("SelectedValue",bindingsource,"field",true)
If your prob is solved then please mark this thread solved and vote me up :)
Regards
thanks bro , thank you so much :)
thanks all of you :) and sorry for my late reply .
no one answered :(
no one replied , :(
hello !
array in vb.net is defined like this
dim array(5) as string
hope this will work fine :P
Regards
hello !
use this code for binding
cboOrganization.DataBindings.Add("SelectedValue", ds.Tables(bsTableName2, "OsID",true)
This will work fine :)
Regards
POS stands for point of sales , it is basically work like a inventory management system ,it manages your stock transactions , purchase , sales , purchase returns , sales returns, claims , little bit accounts. you can further google it , hope google will provide you a very good information about POS
hello!
it takes long time to read your all code , but as far as concern about update query ,you can do like this
dim mycon as new sqlconnection("connection string")
dim cmd as new sqlcommand
mycon.open()
cmd.connection= mycon
cmd.commandtext="update tablename set dbcolumnname1=@Column1,dbcolumnname1=@Column2,dbcolumnname1=@Column3 where recID=@RecID"
cmd.parameters.addwithvalue("=@Column1",txt1.text)
cmd.parameters.addwithvalue("=@Column2",txt2.text)
cmd.parameters.addwithvalue("=@Column3",txt3.text)
cmd.parameters.addwithvalue("=@recID",txtRecID.text)
cmd.executenonquery()
mycon.close()
Hope this will helps you
Regards
right code is
dim Query as string
Query = "Select * from T_INCIDENTS1 where 1=1"
'now for example you have 2 textboxes , txt1,txt2 , for you filter
if txt1.text<>"" then
Query = Query & " And Incident_Postcode='" & txt1.Text & "')"
end if
if txt2.text<>"" then
Query = Query & " and Incident_DMA='" & txt2.Text & "') "
end if
ohh :PPP sorry , i just solve your first issue how to set criteria , sorry again :P
now change your code like this
dim Query as string
Query = "Select * from T_INCIDENTS1 where 1=1"
'now for example you have 2 textboxes , txt1,txt2 , for you filter
if txt1.text<>"" then
Query = Query & " And Incident_Postcode='" & txt1.Text & "')"
end if
if txt2.text<>"" then
Query = Query & " and Incident_DMA='" & txt2.Text & "') "
end if
Hope this time it works fin9 :) sorry , again
Regards
hello!
in you db , date format is same as you specified in your windows , so change the date format .secondly users have concern with the interface , time showing on there datetime picker , there you can set the format property custom and set your required format of date
Regards
hello !
you can do like in this way
'place this code at the single click event of the grid
txt1.text = datagrid.item(0,datagrid.currentrow.index+1).value.tostring
hope this will solve your prob :)
Regards
hello !
you are adding txtPostcode.text and txtDMA.text in your Query , this totally wrong . you are using totally wrong logic for this query , can you please tell me what you want to get from this query , well you can do like this
dim Query as string
Query = "Select * from T_INCIDENTS1 where 1=1"
'now for example you have 2 textboxes , txt1,txt2 , for you filter
if txt1.text<>"" then
Query = Query & " And IFF (txtPostcode.text is notNull) then Incident_Postcode='" & txt1.Text & "')"
end if
if txt2.text<>"" then
Query = Query & " and iff (txtDMA.text is notNull) then Incident_DMA='" & txt2.Text & "') "
end if
Hope this will help you
Regards
ok :) now you can do like this
dim Query as string
Query = "Select * from T_INCIDENTS1 where 1=1"
'now for example you have 2 textboxes , txt1,txt2 , for you filter
if txt1.text<>"" then
Query = Query & " And IFF (txtPostcode.text is notNull) then Incident_Postcode='" & txt1.Text & "')"
end if
if txt2.text<>"" then
Query = Query & " and iff (txtDMA.text is notNull) then Incident_DMA='" & txt2.Text & "') "
end if
Hope this will solve your prob .
Regards