M.Waqas Aslam 67 Posting Pro in Training Featured Poster

use a listbox control and add paths of your sound files in it , then give index of listbox where you have to give path of your sound file ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
your are using complicated code for insert, use this code

Try
            MyFields = "(SalesID,SalesDate)"
            MyValues = "(@SalesID,@SalesDate)"
            dim MyConn as new sqlconnection("connectionstring")
            MyConn.Open()
            Dim Mycmd As New SqlCommand
            Mycmd.Connection = MyConn
            Mycmd.CommandText = "insert into  table1  Values " & MyValues
            Mycmd.Parameters.Add("SalesID", SqlDbType.BigInt).Value = saleid
            Mycmd.Parameters.Add("SalesDate", SqlDbType.DateTime).Value = SaleDate
          
            Mycmd.ExecuteNonQuery()
            MyConn.Close()
            'Return 1
        Catch ex As Exception
            MsgBox(Err.Description)
        End Try

And this will work fine at my end

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
you can play video by adding com component of windows media player , and use windowsmediaplayer.play ="path" to play the video , but what i understand from your question is that you want to play video as a background image of your form , am i right ?
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
you can do this

'use this sub to populate your combobox
sub ComboValues()
dim mycon as new sqlconnection("connection string")
dim dt as datatable
mycon.open()
dim da as new sqldataadapter("select displayfields,valuefield from table",mycon)
da.fill(dt)
combobox.datasource = dt
with combobox
 .DisplayMember = "displayfield"
 .ValueMember = "valuefields"
End Sub

call this on the load event of your form , or if you just want to open another form and then insert a new value and then want to show that value in combo then call this function on the GOtFocus event of your form having combo box

Hope this will helps you

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
can you please tell me are you populating combo box from db using any method ? if yes then call that method at the load event of you form having combo box , if no then can you please rephrase your prob ,

Regards
M.Waqas Aslam

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

you have to close the reportviewer form , in order to show reportB , because we are assigning the report to report viewer on the load event .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
use this

"update Prod_DB_Completed_Board set Stock Level = '" & TextBox2.Text & "' where Laminate = '" & ComboBox2.Text & "' and Board Size = '" & ComboBox3.Text & "'"

It will work fine :) if your prob is solved please mark this thread solved :)

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
this will solve your prob :)
http://www.codeproject.com/Articles/23752/Convert-Number-to-Word
if your prob is solved please mark this thread solved :)

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
use this code ,

Dim MyConn As New SqlConnection("Data Source=(local);Initial Catalog=dbname;Integrated Security=SSPI;")

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

ohhh :P , well use this code to fill :)

dim con as new sqlconnection("string_connection")
dim ds as new dataset
con.open()
dim da as new sqldataadapter("select....from....",con)
ds.table("table1").clear()
da.fill(ds,"table1")
'now you can use this table to fill or populate any control like grid 
gridview1.datasource= ds.table("table1")

hope this time this code will help you :)

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i try same thing at my end , and i works , i use this code

'first make a madule to store global vaiable name ReportName as string 
now place two or more buttons on the form , and place this code on the click event of the button 

ReportName = ""
ReportName = "ReportA" ' this code is on ButtonA click Event
ReportName = "ReportB" 'This code is on buttonB click Event
'now use this code on the load event of the form having report viewer
select case ReportName
 case "ReportA"
           ReportViewer1.ReportSource = New ReportA
        ReportViewer1.Show()
 Case "ReportB"
        ReportViewer1.ReportSource = New ReportB
        ReportViewer1.Show()
EndSelect

Hope this time this will works for you
if Your prob is solved mark this thread solved :)


Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

use sqlcommand , for this purpose

dim con as new sqlconnection("connection string")
con.open()
dim cmd as new sqlcommand 
cmd.connection = con
cmd.commandtext = "your query"
cmd.parameters.add("@rcomer",datatype).value = yourvalue 'cmd.parameters.add("@rcomer",int).value = val(textbox1.text)
cmd.executenonquery();
con.close()

may be there is some spelling mistakes , as i type directly here , so you can check those spellings in VS ,
or directly use your values inside the query , like this

dim myQuery as string 
myQuery = "Select a,b,c from table1 where d=" & txtbox1.text

hope this will solve your problem

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

in this code you are not assigning any report to report viewer , use this

rpvreport_viewer.report=yourreportname
rpvreport_viewer.show()

Hope this will helps you

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

and if you want to open multiple reports in single report viewer then you have to use same code on differnt buttons , for example , buttonA,buttonB , use this code

crViewer.ReportSource = ReportA 'this is for buttonA
crViewer.ReportSource = ReportB 'This is for buttonB

or if you are using some golbal variable then just use select case statement on the report viewer load event

Hope This will helps You

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i mean , are you using crystal reports , telerik reports , active x reports , etc ?

if you are using telerik reports then
use

rptViewer.Report = new yourReportName();

if you are using crystal reports then

crViewer.ReportSource = yourReportName 
CrystalReportSource1.Report = yourReportName

hope this will helps you ,
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
can you please tell me , which reporting tool you are using ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
if u just want to use keypress event then use this code

if e.keychar= chr(keys.m) then 
'here place your code
endif

hope this will helps you
Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think you have to use another select statement to get records according to your required format ,

select ID,Data1 ,Data2,Data3,Data4
from(
select ID,Data1 ,Data2,Data3,Data4
from (
select tA.id,tA.Data1 as Data1,"" as Data2,"" as Data3,"" as Data4
from TableA tA
group by tA.ID
union all
select tB.id,"" as Data1,tB.Data2 as Data2,"" as Data3,"" as Data4
from TableB tB
group by tB.ID
union all
select tC.id,"" as Data1,"" as Data2,tC.Data3 as Data3,"" as Data4"
from TableC tC
group by tC.ID
union all
select tD.id,"" as Data1,"" as Data2,"" as Data3,tD.Data4 as Data4
from TableD tD
group by tD.ID
) as n 
group by id,Data1,Data2,Data3,Data4
) as main
group by id,Data1,Data2,Data3,Data4
order by id,Data1,Data2,Data3,Data4

I think this time it will provide the same result you want ,
Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

u declare first variable Dim strRand As String = lblHomeID.Text , i think the lblHomeID.text is giving the integer value and datatype of variable name strRand is string .
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Thanks BitBlt :) thanks for your help , prob is solved :) yaaa hooo

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

still prob is same :( , i am using mssql server 2008 , is there any wrong with it ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i am developing an desktop application , i want to make my menus just like in VS2008 have tool box , ,when we click on the main tab it will open and slid down , i want to make same thing , is there any one who guide me from where i can start this .
Sorry for my bad english :)

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i think its not possible as far as concern with windows form application to rotate controls ,

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
adam_k you are right , rohne0809 you have to use a stored procedure for this .

create proc MyDoubleInsert @parameter1 varchar(50)..........,@ParameterTable2 varchar(50)
as
insert into table1 values (@ParameterTable1,...........)
insert into table1 values (@ParameterTable2,...........)

exec MyDoubleInsert(value1,value2,.......)

Hope this will helps You

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
please check this link http://www.bigresource.com/VB-Str-Str-and-CStr--jcuerOtRwA.html, hope so it will helps you
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i have not use this query at my end ,please let me know if you have prob .

select ID,Data1 ,Data2,Data3,Data4
from (
select tA.id,tA.Data1 as Data1,"" as Data2,"" as Data3,"" as Data4
from TableA tA
group by tA.ID
union all
select tB.id,"" as Data1,tB.Data2 as Data2,"" as Data3,"" as Data4
from TableB tB
group by tB.ID
union all
select tC.id,"" as Data1,"" as Data2,tC.Data3 as Data3,"" as Data4"
from TableC tC
group by tC.ID
union all
select tD.id,"" as Data1,"" as Data2,"" as Data3,tD.Data4 as Data4
from TableD tD
group by tD.ID
) as n 
group by id,Data1,Data2,Data3,Data4
order by ID,Data1,Data2,Data3,Data4

hope this will helps you
Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello !
i think adam_k is right , u have to use datatable for it or give table name to the dataset ,

dim dt as new datatable
'OR
dim ds as new dataset
ds.table("Table1").clear ' now you have a table name table1 in your dataset
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i think this will helps you , i dont know much about dealing with access so here is code for mssql to perform same function which u want

dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataadapter("ur sql command",con)
dim dt as new datatable
da.fill(dt)
'now take a bindingsource control
bindingsource1.datasource= dt
textbox1.DataBindings .Add ("text",bindingsource1,"Field name",false)
textbox2.DataBindings .Add ("text",bindingsource1,"Field name",false)

after this place a timer control and set interval according to your requirement .1000 = 1 sec
now place this code on timers tick event before this , you have to declare a variable name i on the top as a global variable datatype int

i = i+1
bindingsource1.position = bindingsource.position + 1

this code will change the position of the bindingsource after each tick , and the values of your textboxes will also changed .

Hope this will helps you

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello Every one !
i am trying to make query to show the growth of sale of the product month wise ,i have one table name Sales .having following fields , SalesID,ProductID,amt,Qty,SalesDate
i use this query to show my records

select ProductID,Amt,Qty,substring (datename(month,SalesDate ),1,3)as months,DATENAME(YEAR,salesdate ) as years

this query shows my records in this way
-------------------------------------------
ProductID*****Amt*****Qty*****months*****years
----------------------------------------------
1****************400********6**********Dec**********2011
2****************300********4**********Jan**********2012
----------------------------------------------
I WANT TO SHOW MY RECORDS IN THIS WAY
-------------------------------------------
ProductID*****Amt*****Per.MonthQty*****Cur.MonthQty*****months*****years
------------------------------------------------------------------------
1****************400**********0****************6*************Dec******2011
2****************300**********6****************4*************Jan******2012
------------------------------------------------------------------------

sorry if you are feeling bad after reading it ,
can any one help me to solve this prob :(

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Have a look at DATEDIFF().

thanks , it works for me , :) thank you so much

Regards

M.Waqas

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello Every One !

I m working on a software , i have one field name expiry_Date , now i want to make an query which subtract the current date from the expiry_date and give answer in no.of days , i use getdate() for current date ,

can any one help me:(

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Ok Let me rephrase it

I have 2 forms....
When I click on the button of first form it redirects me to the second form which has a datagrid.
When I select any value from the datagrid and click on a button avaialble in the same form the value that I get from the datgrid shoud be displayed on the first form again

But the issue that I am facing is....
When I click on the button of the second form it open the new first form and the earlier values that were there eneterd manually on the first form goes away....

u should check ur load event of the first form , use this code on the button of the 2nd form.

form1.textbox1.text = datagridview1.item(columnindex,datagridview1.currentrow.index).value.tostring
form1.show()
me.close()

this will work fine , if u face same prob then please show ur code here so that we can find any mistake or u can check again , there should be some logical mistake from ur side ,
Hope this will helps u

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

no one is here ? :(

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

thanks for ur help kamilacbe , but its not performing the task i want to perform , in my xml file there is 3 attributes .
<server>servername</server>
<username>username</username>
<password>password</password>
i want to get jus servername , username , password , and want to show them in my textboxes name , txtservername , txtusername, txtpassword ,:(
can u please help me in this ?

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i want to make a xml file to store my Settings such as server name , user name , and password , etc , i try to search how to read and write xml file i found this code for writing an xml file it works fine for me

private void XMLWrite()
        {
            FileStream fs = new FileStream("c:\\Server.xml", FileMode.Create);

            XmlWriter w = XmlWriter.Create(fs);

            w.WriteStartDocument();
            w.WriteStartElement("Configuration");

            // Write a product.
            w.WriteStartElement("Parameters");
            w.WriteAttributeString("servername", txtservername .Text );
            w.WriteElementString("username", txtusername.Text );
            w.WriteElementString("password",txtpassword.Text );
            w.WriteEndElement();
            w.WriteEndDocument();
            w.Flush();
            fs.Close();
        }

now i have a prob , and prob is that ,i want to read it and show all these values in textboxes present on my form .for example , txtservername , txtusername, txtpassword.
please any one guide me to solve this issue .

Best Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Phoenix911 !
thanks for helping me :) , and i already used this

me.location = new point (x,y)

it works fine but if i change the screen resolution then :( its not works for me , if someone has screen resolution 1024* 768 , and i set my form location 1280*960 , then it will not work

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

U Welcome , Jigs28 , if ur prob is solved , please mark this thread solved :)

Greetings

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i have a form ,having a button on it , i want that when i click on it , my form will show just like the messenger and antivirus and other applications show notifications , at right bottom of the screen , where we have time in taskbar , i dnt want to use the notification balloon .i want to show my form there.
hope this time my question is clear .

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i prefer vb.net for u if u have no knowledge about c or c++ .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello Jigs28 !
use this query may b it works for u

select train_number ,dates 
from table1 
where train_number = @train_number and dates>=@dates

this code return all the records of the train 123 from the given date .
Hope this will helps u , if yes please give thumbs up :)

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i cant get ur point , u just want to move value of the textbox from one form to another or u want to save it then it will show in the previous form ? please rephrase it

Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello !
i m developing a application i want that my notification form will pop up just like messengers , anti virus , and other applications forms pop from right bottom of the screen what can i do for it ,
i m using this code for it

Me.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height - Me.Height)

but its not working :(
Please guide me ,

Thanks in advance
Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

That is most definitely NOT the case. If the Excel spreadsheet is organized as a proper database table (regular rows and columns) then the spreadsheet can be opened as an ADO data source and records can be retrieved just like any other actual database using a connection object and a recordset. If it is not then the data can be read by creating an Excel application object and reading the data cell by cell, then added to the database record by record. In any case, the OP is using MySql and there is no reason to involve Access.

http://office.microsoft.com/en-us/access-help/import-export-and-link-data-between-access-and-excel-HP001095095.aspx

here is another one

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

That is most definitely NOT the case. If the Excel spreadsheet is organized as a proper database table (regular rows and columns) then the spreadsheet can be opened as an ADO data source and records can be retrieved just like any other actual database using a connection object and a recordset. If it is not then the data can be read by creating an Excel application object and reading the data cell by cell, then added to the database record by record. In any case, the OP is using MySql and there is no reason to involve Access.

here is the link how to import excel file to access db http://office.microsoft.com/en-us/excel-help/import-excel-data-to-an-access-database-HP005200852.aspx

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Asslam u allikum !

bro if u dont want to use db , then i think u should use xml to save ur password ,
Regards

M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
Use openfiledialog to open ur required file use rich text box control or textbox control with multi lines ,

Regards
M.Waqas Aslam

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
u have to import ur data from excel to access then u can put all ur data in dataset for populating ur grid then save it in MSSQL ,
but first u have to import ur excel data in access

Regards
M.Waqas Aslam

Reverend Jim commented: Not details and introduces an unnecessary complication (Access). -2
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello!
i think u have to post this question in c# forum , well ,if u want if u give the 5th records value and want to show all the records , starting from 5th row , u have to edit ur sql query , check this one

dim da as new sqldataadapter("select * from table1 where recordid => " & val(txtboxvalue .text),ur_connection)
'this will get all the records having recordid greater then or equal to the providing id.
'now this is c# code
SqlDateAdapter da = new SqlDataAdapter("select * from table1 where recordid => " & val(txtboxvalue .text),ur_connection);

after this code populate ur grid ,

Hope this will helps u , If ur prob solved please mark this thread Solved
Regards
M.Waqas Aslam

Hope this will helps u

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i think , first populate the grid in a normal way then add a new row at index(o)

DataGridView1.Rows.Add()
'place this code in the end after populating ur grid

hope this will helps u , if ur prob will solved please mark this thread Solved

Regards,
M.Waqas Aslam