M.Waqas Aslam 67 Posting Pro in Training Featured Poster

u can do this in this way

dim myPass as string 
mypass = "TopSecret"
'now use this in ur if statement ,
'now if u want to change the password then place this code on ur replace button
mypass = ""
mypass = txtReplacePass.text
'now ur pass is changed

hope this will helps u , if ur prob is solved Please mark this thread solved

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

thank you very much Dude that's What I wanted To do

U Welcome Bro :)
regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello , u can do like this , place this code before con.close();

datagridview1.column(0).headertext = "StudentID";
datagridview1.column(1).headertext = "Last Name";

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

yes u can do this , use selection formula , for this .
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

if ur prob is solved please mark this thread as solved
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hi !
set time format custom , hh , and then save like this , datetimepicker.text :)
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hi !
i think if u use pre defined path for images , then all the images will load at the load event of the form , so there is no use of a progress bar ,

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hi !
if u r using sql db to populate ur grid then use this code

dim mycon as new sqlconnection("ur connection string ")
dim ds as new dataset()
dim da as new sqldataadapter("select * from table1 where fielddate >=" & datetimepicker_from.value.date & "and fielddate<="&datetimepicker_to.value.date,mycon)
ds.table("mytable").clear()
da.fill(ds,"mytable")
datagridview.datasource = ds.table("mytable")

this code only shows the record between from and to date , given by the user ,
hope this will helpful for u,
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hi !
try this code

datagridview1.rows.clear()

it will remove all the rows then assign new data to it
Regards
Hope this will helps u

Regards .
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello skp03 !
bro u can use this code to write ur xml file

Imports System.Xml
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim writer As New XmlTextWriter("product.xml", System.Text.Encoding.UTF8)
        writer.WriteStartDocument(True)
        writer.Formatting = Formatting.Indented
        writer.Indentation = 2
        writer.WriteStartElement("Table")
        createNode(1, "Product 1", "1000", writer)
        createNode(2, "Product 2", "2000", writer)
        createNode(3, "Product 3", "3000", writer)
        createNode(4, "Product 4", "4000", writer)
        writer.WriteEndElement()
        writer.WriteEndDocument()
        writer.Close()
    End Sub
    Private Sub createNode(ByVal pID As String, ByVal pName As String, ByVal pPrice As String, ByVal writer As XmlTextWriter)
        writer.WriteStartElement("Product")
        writer.WriteStartElement("Product_id")
        writer.WriteString(pID)
        writer.WriteEndElement()
        writer.WriteStartElement("Product_name")
        writer.WriteString(pName)
        writer.WriteEndElement()
        writer.WriteStartElement("Product_price")
        writer.WriteString(pPrice)
        writer.WriteEndElement()
        writer.WriteEndElement()
    End Sub
End Class

hope this will helps u
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hi!
u want to move textbox from one form to another ? y not u try to get values from textbox of first form to textbox of 2nd form ,

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello sir ive got the same question but i need to display the datagrid selected row value to another form when it is clicked so there it can be edited.. can you guide me how to do it..?

yes u can easily do this , use this code
if u have a form1 and frmsearching then
post this code on the frmsearching datagrid

form1.textbox1.text = datagridview1.item("column name/column index",datagridview1.currentrow.index).value.tostring()'use this code on the double click event of the grid
form1.textbox1.text = datagridview1.item("column name/column index",datagridview1.currentrow.index-1).value.tostring()' use this on the keypress event of the grid

hope this will helps u

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think u try this code on the text change event of the textbox1 and on the form load event also ,

Sub MySaleInvoiceList()
        On Error Resume Next
        Dim myQuery As String 'defining a string 
        If textbox1.Text <> "" Then 'here i m chking that is user try to search? 
            myQuery = "select SalesID,SalesDate from Sales where  salesid = " & Val(textbox1.Text)'if user try to search then this code will execute
        Else
            myQuery = "select SalesID,SalesDate from Sales "'else this query will run

        End If

        MyConn.Open()
        Dim dt As New DataTable 
        Dim MyCommand As New SqlCommand(myQuery, MyConn)
        Dim myDataAdapter As New SqlDataAdapter(myQuery, MyConn)
        myDataAdapter.Fill(dt)
       DataGridView1.DataSource = dt
        MyConn.Close()
    End Sub

Hope This Will Helps U

Best Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

when u recive a msg from other user , u place the textbox1.text = other's msg , before this place ur bgcolor change code or icon change code ,
form example

form1.bgcolor = yellow
textbox1.text=__your msg procedure__
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

there is may b another solution of ur prob is to change the project start up form ,i dnt knw is this is possible or not , but try to search this method , and if u find any solution please let me knw ,

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello skp03 !
i think u have to use xml file. when u run ur application first time then a form1 is load first, put ur code to chk that the xml file is present in directory if yes then hide the form and load the form2 , and also create the file , next time when ever u run ur application ur form1 chk that file is present form1 quickly load form2 and hide it self ,this is not the ideal solution , but i think it will work fine
Hope This Will helps You

Best Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello kurakar !
there are two ways to perform ur required operation.
1- use bindingsource
2-manualy show records in textboxes.
now here is the code to bind the textbox.

'first assign the same datasource to bindingsource which is used to assign the datasource to gridview.
bindingsource1.datasource = 'write ur datasource.
'after this now bind ur textboxes with this bindingsource.
textbox1.databinding.add("text",bindingsource1,"__your field name___",false)'u have to write checked for chkbx , and selected for the raio button in the place of "text" and when u bind picture box then change the false to true ,

by using above code ur controls bind with ur datasource , now if u select any row the result will show in textboxes ,
now here is an other method for doing same thing.

sub GridValues()
'now u have to manualy assign the values to the textboxes
textbox1.text = datagridview1.item("__ur column name__",datagridview1.currentrow.index).value.tostring 'in the place of column name u can also place the column index .
EndSub

after making this sub , now call it on the keypress event of the grid and double or single click event of the grid .
Hope this will helps u
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello ajkva !

u have to declare module and then declare some global variables so that only a single form can is used for searching for two form User and Product.for example

public UserForm as boolean 
public ProductForm as boolean

then where ever u want to call the searching form then make the value of the boolean variable true ,and write the following code in the load event of the searching form.\

if UserForm = true then 
userSearching() ' this sub is for user searching
endif
if ProductForm = true then 
ProductSearching()' this sub is for Product searching
endif

and then put all the previous coding according to ur requirement .

Hope this will helps u
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
look , for example i have 2 textboxes in my vb form, i want that when i press enter key the focus move from 1st textbox to 2nd textbox , i use this code on my every control to move focus

if e.keychar = chr(keys.enter) then 
textbox2.focus ()
endif

can any one help me to make a function to do same action when i press enter the focus move on next control , this sort of coding take so much time , :( please help me

Best Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think u want to make a simple login form with password and username change option ,
u have to simple use update statement for this ,

dim da as new sqldataadapter ("update users set (username=@username,password=@Password where userid =@userid)")

hope this will helps u

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello archelle ,
y not u use bindingsource for this purpose , what u have to do is to give datasourse to bindingsource then set that bindingsource as a datasource of the grid , now bind ur controls with it , for example , if u have a textbox1 , then what u have to do is

textbox1.databind.add("text",bindingsource,"__fieldname__",false)'by default value is false already

by using this code u can easily bind ur controls with ur datagrid
Hope this will helps u

Best Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

when u build ur project , for making exe , the panel where u add ur bin files and set icon to ur program , there is solution window on ur right side ,right click on it and a new window will open , on the next window u found the prerequisite button , press it ,
then select ur prereuisite , from the selection panel , like windows installer , dot net framework , etc , then there will b 3 option in the bottom select 2nd option then , press ok , and build ur project as u do normaly , thats it , now when ever the peron run the setup if prerequisite are not installed before then setup will automatically install them.
hope this will helps u :)

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try to use the xml , to remember your application setting , i used xml file in my project to store , dbname , servername , bgcolo , text , location ,and other information , try to use xml to store your settings ,
Hope this will give u some idea ,

Best Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello ajkva !
if my main form has a txtUserID , txtUsername , and i want to search them by using an other form , then i have to take a new form and place a grid on it and also take bindingsource component , now code this on the load event of the searching form

dim mycon as new sqlconnection("connection string")
dim ds as new dataset
mycon.open
dim da as new dataadapter("select userid , username from users",mycon) 
ds.table("User").clear
da.fill(ds,"user")
bindingsource1.datasource = ds.table("user")
datagridview1.datasource = bindingsource1
mycon.close()

by using this code , on the load event of the form the datagrid is populated with records , then what u have to do is to code on the keypress event and on the double click event of the grid ,
now first we have to code for the double click event of the grid , but make sure before coding , that selection property of ur grid is set to row selection
now place this code on the double click event of the grid

form1.txtuserid.text = datagridview1.item("userid",datagridview1.currentrow.index)
.value.tostring
form1.txtusername.text =datagridview1.item("username",datagridview1.currentrow.index)
.value.tostring
me.close()

after this when u double click on the grid , ur txtuserid and txtusername is populated , and ur selection form is closed , now move toward the second step , we have to code for the keypress of the grid ,

if e.keychar= chr(keys.enter) then 
form1.txtuserid.text = datagridview1.item("userid",datagridview1.currentrow.index-1)
.value.tostring
form1.txtusername.text =datagridview1.item("username",datagridview1.currentrow.index-1).value.tostring
me.close()
endif

after all this , ur program will work perfectly

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hi i my self mujtaba and i want a railway software to book railway ticket
so plz help me

please reply ..............

what kind of help u want , ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think u have to use the concatenation , of year and ur auto grnated number then insert it in db .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello nedrosat!
u have to use the the value member of the combobox u r using
for example

datagridview.item("columnname",datagridview.currentrow.index).value = combobox.selectedvalue

may b this will help u

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello kurakar ! ,
basically i m using vs2008 ,in 2008 i m using bindingsource for this purpose , i bind my form controls with same bindingsource which is used by me to populate the datagrid ,
by doing all this when ever i click on my grid row same records are shown by my textboxes , sorry for my bad english

Hope this will help u

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello Pooja !
m not sure that the solution i m providing u is helpful for u or not , but i regularly using this thing in my projects , y not u try databinding and bindingsource , like this
take a bindingsource1

dim dt as new datatable
dim mycon as new sqlconnection("ur conn string")
mycon.open()
dim da as new sqldataadapter("ur command",mycon)
dt.table("mytable").clear
da.fill(dt,"mytable")
bindigsource1.datasource= dt.table("mytable")
'here u have to bindg ur form controls 
datetimepicker1.databind.add("text",bindingsource1,"__ur field in db__",false)' i use here text insteadof time , u can use time also
'with this u can also bind the textboxes and other controls on form

hope this will help u , and yes keep ur custom settings for ur datetime piker to just show time ,

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello skp03!

y not u r using ur projects shortcut for this ,

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think u have to use a sql view , to get your required data .
then use this code to show ur all data in grid
take a binding source first

sub mydata()
dim mycon as new sqlconnection("connectionstring")
mycon.open()
dim dt as new datatable
dim da as new dataadapter("select * from __here write the name of ur view___",mycon)
dt.table("mytable").clear
da.fill(dt,"mytable")
bindingsource.datasource=dt.table("mytable")
datagridview.datasource = bindingsource
endsub

if u tell me about ur tables then i will try to make query for u ,
hope this will help u

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello nore !
you can do like this , just take a bindingsource and use this coding

Sub MyGridData()
dim mycon as new sqlConnection("your conn string")
dim myDataTable as new DataTable
myconn.open()
Dim myDataAdapter as new SqlDataAdapter("your query ", mycon) 
myDataTable.table("MyTable").clear
MyDataAdapter.fill(myDataTable,"MyTable")
BindingSource1.datasource = myDataTable.table("MyTable")
GataGridView.DataSource = bindingsource1
EndSub

Use this sub .

Hope this will helps u

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello Poojavb !
you can use following code to populate your combobox

dim mycon as new sqlconnection (your connection string)
dim mydataset as new dataset
dim bindingsource1 as new bindingsource
mycon.open()
dim da as new sqldataadapter("select patientname from patient",mycon)
mydataset.table("Patient").clear
da.fill(mydataset,"patient")
bindingsource1.datasource = mydataset.table("patient")
combobox1.datasource = bindingsource
combobox1.displaymember = "PatientName"
bindingsource1.datasource =

hope this will help u :)
Regards
M.waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello aishapot !

you can use substring functions , for example you have number 1234567890

Dim p1, p2, p3, p4 As String
        If TextBox1.Text.Length = 10 Then
            p1 = TextBox1.Text.Substring(0, 3)
            p2 = TextBox1.Text.Substring(3, 3)
            p3 = TextBox1.Text.Substring(6, 2)
            p4 = TextBox1.Text.Substring(8, 2)
            TextBox1.Text = "(" & p1 & ")" & p2 & "-" & p3 & "-" & p4
        End If
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello Every One !

i was using my code

textbox1.bgcolor = ___colorname___

on the gotfoucs event of my textbox , but if i have 34 textboxes then i have to write this line 34 times , which cost lots of time , can any one help me to make any function or sub , so that it can automatically change the bgcolor when textbox gotfoucs ,
thanks in advance,

Best Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !aishapot
i think you should take multiple picture boxes, and then databind them with your data source , may b your code look like this

dim mydataset as new dataset
dim myconn as new sqlconnection(___your connection string)
dim da as new sqldataadapter(your query,mycon)
mydataset.table("MyImages").clear
da.fill(mydataset,"myimages")
bindingsource1.datasource = mydataset("myimages")
picturebox1.databing.add("Image",bindingsource1,"_dbfieldname",true)
.
.
.
.
mycon.close()

and so on ,
hope this will help u , and if u dont knw the no of students and you want to perform all the dynamically then i think you have to create multiple picture boxes using any loop , for example

dim i as int64
for i = 0 to bindingsource -1 
  Me.PictureBox(i) = New System.Windows.Forms.PictureBox
next

Best Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Are you referring to using CSS to style the location of the button?

i m not using css in my project , i just want to place my delete button which is auto generated at the right most side of my grid ,

Regards

Waqas

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hi !
i m working on asp.net project and using c# for it , i want to place my delete button on the right most of the gridview , by default button is placed at left side of the grid , can any one please help me . as i m new in c#

Best Regards

Waqas

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hi !
I want to develop an application in vb.net which can save any open Text Document , Notepad ,Ms-Word ,Ms-Excel etc , The main theme is that my application simple send the SAVE command .
i use SendKeys.send("^S") , SendKeys.send("^ + S"),SendKeys.send("{^+S}"),SendKeys.send("{^}+{S}"),SendKeys.send("{Ctrl}+ {S}") . but nothing happening.can Any one guide me how to make it possible :(

Thanks in advanced ,

Regards

Waqas aslam meo