M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well simple use this.

msgbox(txtbox.text)

and if you have so many txtboxes and want to show the data in masg then you can use this.

msgbox("name:" & txtName.text & vbCrlf & "Age:" & txtAge.text)

hopr this will help you.
Regards.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well you have to add columns first in order to add any value to your grid.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well simply use this.

frmOne.button1.enable = false

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well i think , you can just make two public functions for got focus and lost focus , and just call them , this will reduce your code ,

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

ok do like this , for example your 2nd column of grid is you amount column , which you want to sum ,

dim mySum as integer
mySum = 0
for i = 0 to datagridview1.rows.count -1 
nySum = val(datagridview1.item(1,i).value.tostring) + mySum
Next

This will Sum all the rows of your grid.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

yes just after the code where you assigning the datasource to your grid use this code.

datagridview1.column(0).headertext = "your text"
datagridview1.column(1).headertext = "your text"
.
.
.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i am now working on office management system. i have a code to disable the usbport , i want to use it in win7 , before this i already used it in other project on windows xp , it works fine , but now in windows 7 it says you have not proper perviliges , now i want to run my application run as administrator , is there is any way to run it.
waiting for your replies ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please check this out Click Here hope this will solve your prob :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well , you can do by saving all your data in a text file , and read that file at the load event , and simply fill your controls with that data.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

yes you can easily do this , first just add a bindingsource in your form and do like this.

dim con as new sqlconnection("your connection string")
dim dt as new datatable
con.open()
dim da as new sqldataadapter("select * from table1 ",con)
da.fill(dt)
bindingsource1.datasource=dt
con.close()

after this you can call following code , for move last , first , next , previous.

bindingsource1.movelast() 'this code is to move last
bindingsource1.movefirst() 'this code is to move first
bindingsource1.moveNext() 'this code is to move next
bindingsource1.movePrevious() 'this code is to move back
' as i am typing all this here so may be there is some mistake, so check it by your self.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
use this code at the search textbox textchange event.

Sub search()
dim con as new sqlconnection("your connection string")
con.open()
dim dt as new datatable
dim da as new sqldataadapter("select * from table1 where firstname like '%" & txtSearch.text & "%'",con)
da.fill(dt)
datagridview1.datasource= dt
con.close()
End Sub

simple change this code ,hope this will work fine.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

thanks all of you , i just manage to do it in other way using dataview control in ExtJs. thanks for your time and help . God bless you in your lifes.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i have query , in which i am concatinating different fields and making a simple string , the length of string is very large, i want to put line break in it , i dont know to do this , my string is now in this format.

LotNo:12 (prod:abc,Qty:45,rate:56,date:12/7/2012),LotNo:13 (prod:abc,Qty:45,rate:56,date:12/7/2012),LotNo:14 (prod:abc,Qty:45,rate:56,date:12/7/2012)

i want to show like this
LotNo:12 (prod:abc,Qty:45,rate:56,date:12/7/2012)
LotNo:13 (prod:abc,Qty:45,rate:56,date:12/7/2012)
LotNo:14 (prod:abc,Qty:45,rate:56,date:12/7/2012)

i already used char(13) but same result. please help me in this ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Still no one here :(

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello , no one is there to help me on this :(

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please do not post same question with different wordings , this is your third one i am watching right now , bad habbit .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please just check Click Here and search there you will find some demo projects about this. hope this link will provide you enough information to take your first step.
i think you have to make your base of socket programming before doing something like this.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello !
i am working on a simple asp.net project , i have two forms , frmlogin.aspx and frmmain.aspx , i want to redirect my frmlogin.aspx when my session is expired. i already added global.asax. i used all these codes at the session end event of it ,

HttpContent.Current.Response.Redirect("frmlogin.aspx");
Server.Transfer("frmlogin.aspx");
Response,Redirect("frmlogin.aspx");

but nothing happend. Please i need help on this.
Best Regards.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

there is another method to do this is
use this code at the textbox textchange event

dim con as new sqlconnection("connection string")
dim dt as new datatable
con.open()
dim da as new sqldataadapter("select * from table1 where name like '" & textbox1.text & "%'",con)
da.fill(dt)
datagridview1.datasource = dt
con.close

hope this will helps you ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well if you have a form having diff controls , like datetime picker , picture box , textboxes and you want to populate them by using combo box. you have to bind all your controls with your datasource , like this .

dim con as new sqlconnection("you connection string")
con.open
dim da as new sqldataadapter("select * from table1 where name ='" &      combobox1.selectedvalue & "'",con)
dim dt as new datatable
da.fill(dt)
con.close
'take a binding source from tool box.
bindingsource1.datasource = dt 
'here you can bind your controls like this.
datetimepicker.databinding.add("text",bindingsource1,"_ur_datefieldname",false)
Picturebox1.databinding.add("image",bindingsource1,"_ur_Pixfieldname",true)
radiobutton.databinding.add("checked",bindingsource1,"_ur_fieldname",true)
checkbox.databinding.add("checked",bindingsource1,"_ur_fieldname",true)
combobox.databinding.add("text",bindingsource1,"_ur_fieldname",false)
textbox1.databinding.add("text",bindingsource1,"_ur_fieldname",false)

hope this code will help you ,

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

sorry i cant get your point , well in above code , i use array list , if you remove index 2 then the item at index 3 will auto move to index 2 , same case in list box , well if you be more specific about your point then i think i can give you better answer ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well i think it is much better that you allow your user to make changes in grid after that press save button to save all the changes , this will not put load on your db , but i think in your case you may use cellvaluechange event , to use update code.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

you want to some to give you working code ? if yes :P then NO ONE will give you , please do some efforts before asking any thing :P

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

when ever you find this type of error ,please type your query in management studio it will help you to find errors ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

sir i am using windows 7 , on both systems ,

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well just set the format property to time and set showUpDown property true , :P

if this answer solve your porb , please vote up .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

this error comes when we try to insert the FK value which is not in it Parent table.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

:P , so please can to tell where i can get any thing usefull ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello
please see these links hope they will solve your prob
Click Here
Click Here

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

still no is there to guide me :(

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

satti you just have these three words ? or your are giving example:P

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well , you have to use the array list , for this purpose ,
here is what i tried at my end first i add a list box and a button on my form , i add 4 items a b c d manually in the list box , then i declare an arraylist and used this code at the load event of my form

       Dim i As Integer
        For i = 0 To ListBox1.Items.Count - 1

            Dim a As String
            a = ListBox1.Items(i).ToString()
            MsgBox(a)
            arr.Add(a)
        Next

this code will insert all the items of the list box in my array list , now i used this code the remove button

 Dim i As Integer
    i = ListBox1.SelectedIndex
    ListBox1.Items.RemoveAt(i)
    arr.RemoveAt(i)

this code will remove items of from the listbox and also from the array list ,

this code is random , and not in a ideal format , may be this approch is acceptable for you , but i hope this code will help you.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i am using mssql server 2008 , i have a table with three fields , 1- ProdID 2-ProdName 3-ProdPic , now i want to show the all records of the table in the datagridview by using vb.net , how can i show my image field in datagridview , even i create three columns , and the third column has column type image. now i dont know how to bound my datagrid with my datatable . i am using code like this

dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataadapter("select ProdID,ProdName,ProdPic",con)
dim dt as new datatable
da.fill(dt)
datagridview.datasource = dt
con.close()

now prob is that i dont know how to bind my grid columns with my dt , , please guid me so that i can complete my project.

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

thank you so so very much both of you , pooja this time your code worked perfectly ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

any one help me.:(

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

thanks pooja , !
i am now using this code

    IO.File.Create("C:\Towns.txt")
            FileClose()
            IO.File.Create("C:\Customers.txt")
            FileClose()
            IO.File.Create("C:\Products.txt")
            FileClose()

but still i got same error , :(

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello all of you !
i am making a simple form which can create the text file from the database table , for this , i am using this code at the load event of my form so that it can create the files at the load time.

            IO.File.Create("C:\Customers.txt")
            IO.File.Create("C:\Towns.txt")
            IO.File.Create("C:\Products.txt")

this code is working fine , but when i try to write my data in these file then the error come which is
"the process cannot access the file 'c:\towns.txt' because it is used by another process"
i dont know where this file is used by my computer , Please help me in this as i am stuck here , if you have somthing better then this .please tell me

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well i got solution of my prob , now i am directly writing all the records from the datatable, like this

dim con as new sqlconnection ("connectionstring")
con.open()
dim da as new sqldataadapter("query",con)
dim dt as new datatable 
da.fill(dt)
 For Each dtr As DataRow In dt.Rows
                    Dim str As String
                    str = dtr.Item(0).ToString & " " &  dtr.Item(1).ToString 
                    objWriter.WriteLine(str)
 Next

this is very fast and simply the best so far :P ,
but thank you both of you , :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

thanks kRod and jim for your time , well i have 25000+ records in my grid , it takes very long to complete .and there is nothing runing with it.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
this is my code , i am writing a text file form the datagrid, but this code is very slow , please check it out and give me some advice how i can make my code fast ,

 If IO.File.Exists("C:\Customers.txt") = False Then
            IO.File.Create("C:\Customers.txt")
        End If

        Dim FILE_NAME As String = "C:\Customers.txt"

        If System.IO.File.Exists(FILE_NAME) = True Then
            Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
            Dim i As Integer
            Dim strheading As String
            strheading = "CustomerID           CustomerName"
            objWriter.WriteLine(strheading)
            For i = 0 To dgvMain.Rows.Count - 1
                Dim str As String
                str = dgvMain.Item(0, i).Value.ToString() & "                " & dgvMain.Item(1, i).Value.ToString()
                objWriter.WriteLine(str)
            Next
            objWriter.Close()

if you have better code then this please show me so that i can complete my current task.

Best Regards

Muhammad Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

thank you so very much for your time and information :) i am trying to get out of it .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well set the backgroud color property ----> transparent (in web tab). hope this will solve your prob.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

let assume if we have a group box , having some textboxes , now you set the dock fill , if we resize the form , the grouup box will expend , but your controls will be at there position , you have to set the anchor property of your each control so that they can stay at there position in the group box.

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
well i dont have any idea about the socket programming ,i am developing an lan chatting application , i want to add the file transfer functionality in it , now you are thinking that why not i share my folder over network , well i dont want to do it in this way , i want to select file and then send it to my required pc over lan , how can i do this , please help me in this.

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

but your control will not adjust with the form size , by using dock panel.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well i think you have to set the anchor property of your form and controls so that when ever size of your form is changed the control will also set their locations. and you can also use flowlayoutpanel control it will also set the position of your form according to your requirement.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
may God bless all of us , well i am working on a project in which i need to create a simple desktop viewer , a user can view the screen of any computer in LAN network , how can i do this , as this is very first time i am doing socket programming , please guide me where to start , what i want to perform is ,
1- just to view the screen of any computer using ip in LAN network , no need of keyboard or mouse.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well , i got answer of it , just create a vb.net class library project , add all your code and built it ,you will find dll in your projects bin folder.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !

i love to use cell phone apps , but now i want to develop them , please guide me which is the best and easy sdk for android mobile applications , and from where i can start working on it.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i am working on a c# project , but i had done all this is vb before , now i have all the code in vb.net and i want to use it in c# project , someone told me that if i make dll of my vb modules and classes then i can use those dll in my c# project , please guide me how can i do this , as it will save my lots of time to code all that again.

Regards

Muhammad Waqas Aslam