M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hye !

what I understand from your question is that you have comboA and comboB and when you select the comboA then records of comboB will filter ? am i right ? .
Try to do something like this .

//Let suppose we have two comboboxes , 1- cmbSelector 2-cmbFilter 

sqlconnection con = new sqlconnection("your connection string");
con.Open();
sqldataadapter da = new sqldataadapter("select TypeId,TypeName from tbl",con);
Datatable dt = new Datatable();
da.fill(dt);
cmbSelector.datasource = dt;
cmbSelector.DisplayMember = "TypeName";
cmbSelector.ValueMember = "TypeId";
con.Close();

//now here is the method which will populate the cmbFilter

private void GetFilter(int TypeId)
{
    sqlconnection con = new sqlconnection("your connection string");
    con.Open();
    sqldataadapter da = new sqldataadapter("select ProductId,ProductName from tbl2 where TypeId=" + TypeId,con);
    Datatable dt = new Datatable();
    da.fill(dt);
    cmbFilter.datasource = dt;
    cmbFilter.DisplayMember = "ProductName";
    cmbFilter.ValueMember = "ProductId";
    con.Close();
}

// now call above method on the selected index change event of cmbSelector.
//Like this

GetFilter(convert.toint16(cmbSelector.SelectedValue));


hope this will help you
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hye !

hope this code helps you

dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataadapter("select username ,password from table",con)
da.fill(dt)
cboUser.datasource = dt
cboUser.Displaymember = "username"
cboUser.Valuemember = "password"
con.close()

' now we have two textboxes , txtUsername and txtPassword. and we want to set there values

'on selected index change event of the combo box , use this code.

txtUsername.text = cboUser.Selectedtext.tostring()
txtPassword.txt = cboUser.SelectedValue()

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

May be this one help you
select * from tbl where myDate between dateadd(day,1,dateadd(month,-1, myDate)) and myDate

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

I just find the solution , here it is hope this will help someone else.

convert.ToDateTime("2013/09/16").ToString("D")

Thread is solved.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Dear All !

I need to convert date 2013/09/15 to this format Sun, Sep 15, 2013 . any type of suggestion would be greatly appreciated.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Thread is solved ,

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Dear All!

I have an ASP.net page , and my page is supportted in two language , english and arabic . when user click on arabic , i want to make my all text right align.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i found this query to create the backup of the system

BACKUP DATABASE [D:\testing.mdf] TO disk = 'C:\PathToBackup\BackupFileName.bak'
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

do somthing like this

select * from table where id in (@id) and username(@firstname)
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try to do somthing like this ,
after adding all records normally to your datatable , add column like this ,

myDatatable.column.add("your columnname")
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

could please provide error message text.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

if problem is solved , please mark this thread solved.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

for integer datatype , you have to conver your values into integer first , like this

Dim myindex As Integer
myindex = val(DataGridView1.CurrentRow.Index)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

It is very simple , just get the file path , open it , and read all the text and then save it to your database. here are some links, helps you to understand the method of reading textfiles using vb.net .
Click Here and Click Here

Hope this will help you.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think you can not change color of the text in dgv . because there is no css involves init , we could easily make graphical changes in webforms ,but i am afraid that it is not possible in desktop applications. May be there are some thired party tools available to perform such actions.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please be more specific , i think you could use need datasource event of telerik report. and get selected record of the grid there and then assign values to your report textbox. like this

' do something like this in need datasource event of the report.

'i am taking two textboxes FirstName and LastName in the report 

txtFirstName.Value = form1.datagrid1.("Firstname",datagrid1.currentrow.index).value.tostring()
txtLastName.Value = form1.datagrid1.("Lastname",datagrid1.currentrow.index).value.tostring()

This code will assign firstname and last name in the telerik report.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hmmm , then you could add row manually using datareader . i could provide you a sample code but in c# as its very long time i am untouch with vb.net . method will be same for both languages but yes little difference in syntax .
So if you are ok with it please do mention , i will try to get you out of this .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

use this connection string to get your application connected with excel file

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES";

and then just use query like this

select * from [$sheet1]

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

May be when someone delete record ,instead of deleting records code is setting any flag in the table.

to get the clue , you could check the code which is retriving records from the db. there may be any filter criteria.

Regards

Begginnerdev commented: That was the same thought process I had as well. +8
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

if you are getting these records from db then you can just use Count() to get total number of records , here is a sample query from mssql

select name , count(*)
from table1
group by name

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

if you are using mssql then use this query

select field1 , field2 from table1 where table1.DateField = getdate()

Regards.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try something like this

string[] strValues = txtHtmlTextBox.Text.Split(',');

for(int i =0 ; i<= strValues.Length-1;i++)
{
    //assign values to your textboxes like this
    //txtDemo.Text=strValues[i];

}

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

1- New Project -- other project types -- setup and development -- visual studio installer -- setup project--- Ok
There will be three folders on your left , application folder user desktop , user programs menu
right click on this panel Add special folder option will appear , select option user's startup folder.
a new folder will appear ot left panel , select it and on right side add .exe file to it.
Done :-D

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello All !

I want to make my gridview pagination look like this

First -prev -- 1 -2 -3 -4 -Next -Last

How can i do this , by using options of Mode it is not possible.

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think if your column datatype is not supported to 20's , if you are using mssql server then nvarchar datatype may help .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

use session instead of query string. as it is good for security of your site.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

you want to use conditions in your db quries ? please be for specific regarding your desired result.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

which database you are using ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Thanks for your time pritaeas. I created two constraints here is the code for others.

ALTER TABLE member_email
ADD CONSTRAINT chk_Email_Cell CHECK(
                (cellNbr is not null and email is null)
                or
                (cellNbr is null and email is not null)
    )


ALTER TABLE member_email
ADD CONSTRAINT chk_Cell_Carrier CHECK(
                (cellNbr is not null and Carrier is not null)
                or
                (cellNbr is null and Carrier is null)

    )

Thread is solved.
Regards

pritaeas commented: Thanks for sharing. +14
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Dear All !

I have a table member_email. i have 4 columns in it.
Id
Email
CellNumber
Carrier

I want to create constraint who check following conditions,
1-Email can be null if Cellnumber is given , and Cellnumber can be null if email is given.
2-both email and cell number can not be null in one record.
3-If cellnumber is available then carrier should not be null. Carrier will be null if email is given and cellnumber is not available.

Need guidence.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

@Zaki welcome brother :)

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

simple use datareader object to perform this operation , here is a sample code.

dim con = new sqlconnnection("connection string")
con.open()
dim cmd = new sqlcommand("select a ,b ,c ,d from table1 where id = " & txtId.text,con)
dim da = sqldatareader()
da = cmd.executereader()

while da.read()
    txtA.text=da["a"].Tostring()
    txtb.text=da["b"].Tostring()
    txtc.text=da["c"].Tostring()
    txtd.text=da["d"].Tostring()
end while

da.close()
con.close()

I typed code here so may be there are many spelling and other syntex mistakes are there as currently i am working in C# for 1.5 years so i just forget VB syntx. But here is an idea hope this will help you to solve your prob :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well if you want to create setup then you can simply do this ,
create a new project , name setup and development , when project will open , you will find three options on your left side. one will be application folder , select this option and then right click on the panel at your right side. select add files , then browse your bin directory and add all files in it. then click ok , after that select second option on your left side user desktop , and after selecting it just right click on right panel and select option create desktop shortcut , rename it. build your solution .

Done :P

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Read it Click Here

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

use anchor. it will do same as your requirement.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster
select Distinct t.Student ,(Select count(scores) from table where student = t.Student)
From Table t
where credit > 2 and credit > 10

may be this will help you .
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

can you please mention which error you are getting in this above mentioned code.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

1-you did not define dataadapter2 .
2-and you are fill dataset1 and same table with it.

First assign query and connection to dataadapter2 then fill dataset1 with it.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

this error came when your database field size is smaller then your data.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

but i am not able to download css , js files , and images of any page , it just give me inner html of the page , here is my code

string url = "http://google.com";
string strResult = "";

WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);

objResponse = objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
strResult = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}

// Display results to a webpage
MessageBox.Show(strResult);

i want to save webpage on my local drive just like we use save as option of any browser.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello !

I want to develope a website downloader . which can download entire website on my local drive. i manage to download html code of any page and then save it as .html . but this is not good. can anyone give me any idea to complete my task.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello !

hope all of you are fine , i want to know how can i add fb api to my website , i find lots of code on different websites to grab profile picture of any given account , but i haven't find anything regarding adding api link to webpage. Can anyone help me in this.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think in a desktop application it is not possible , because you cannot have anything life css of any object . but yes for web applications.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think you have to make getter and setter functions for specific textbox and then use them to get and set values . i think there is a property of modifier , it is private bydefault change it to public try it.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

you can decompile the application, hope you find a way . :P

Regards

Begginnerdev commented: Yep! +8
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

use this

 ddl_Course.DisplayField = "course_name";
ddl_Course.ValueField = "course_id";
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

tola = grams/12.5
masha = (grams/12.5)/12 or tola/12
ratti = ((grams/12.5)/12)/8 or masha/8

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i dont know , in which database your are working , here is a query you can use for mssql server. hope this will help you

Select p.EmpNumber,p.ss,q1.wages,q2.wages
From Personel p 
left outer join q1 on p.personelid = q1.personelid
left outer join q2 on p.personelid = q2.personelid

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

dog

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Please post your complete code ,