|
Is there a way to logon to a website that requires a userid and password from vb.net?
ty
|
|
|
|
|
Can you be more specific?
There are several ways to login to a website that uses a username and password. Check out the .NET 2.0 User Login Controls. Or check out the Cookies classes the framework aswell. You could also use sessions.
What exactly do you want to accomplish?
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
I simply want to get the content of a site that is password protected:
dim userid = "myuserid"
dim password = "mypassword"
Dim res As Byte() = web.DownloadData("myhttp://....")
I'm thinking I need to set userid and passwored using web.Icredentials or something before I make that call, but I'm not sure how to do that.
thanks!
|
|
|
|
|
Yes, you need to navigate to the login page, work out how to fill the form, and how to submit it. Unless they offer a webservice.
Christian Graus - C++ MVP
|
|
|
|
|
Really? I'm thinking there must be some generic code for this. For instance, there are many programs that routinely recognize a logon web page and fill the forms for you. Right?
|
|
|
|
|
How do you think they work ? They are HTML parsers, and they fill the form fields for you, based on having stored where they are in the page, and what you typed in them before.
Christian Graus - C++ MVP
|
|
|
|
|
hello
here i am posting my code for quiz application and i want to randomize 4 answers 3 wrong and 1 correct answers i manage to randomize correct answer but other three answers are not but it shows three wrong answers but it's from other question
Dim Question(14), Ans1(14), WrongAns(14, 3), Clue(14), CorrectAns(14) As String
Dim TotalQuestion2 As Integer
Dim Score2 As Integer
Dim startTime As DateTime
Dim Time As Date
Dim N As Integer
Dim Asked(14) As Boolean
Private Sub mnuFileTyAns_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuFileTyAns.Click
Dim MyForm As New frmSQuiz
MyForm.Show()
MyForm.ActiveForm.Text = "Well Come " & Address & " to Type - In - Answer Section ...."
Me.Close()
End Sub
Private Sub mnuHelpAbout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuHelpAbout.Click
Dim MyForm As New frmAbout
MyForm.Show()
MyForm.txtAbout.Visible = True
MyForm.ActiveForm.Text = "About Quiz ......"
End Sub
Private Sub mnuFileExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
Me.Close()
End Sub
Private Sub frmMultiple_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
Time = Now
'get questions and answers arrays
Question(0) = "Macadamia and almonnd are types of what ?" : Ans1(0) = "Nuts" : WrongAns(0, 0) = "Fruit" : WrongAns(0, 1) = "Tree" : WrongAns(0, 2) = "Vagetable" : WrongAns(0, 3) = "Powder" : Clue(0) = "Do you know about any magazine ?" : CorrectAns(0) = "Nuts"
Question(1) = "In astrology the star sign Piseces is represented by which animal ?" : Ans1(1) = "Fish" : WrongAns(1, 0) = "Donkey" : WrongAns(1, 1) = "Lion" : WrongAns(1, 2) = "Snake" : WrongAns(1, 3) = "Lynx" : Clue(1) = "It,s very testy" : CorrectAns(1) = "Fish"
Question(2) = "Where is Tower bridge ?" : Ans1(2) = "London" : WrongAns(2, 0) = "Dubai" : WrongAns(2, 1) = "USA" : WrongAns(2, 2) = "India" : WrongAns(2, 3) = "Pakistan" : Clue(2) = "Sterling" : CorrectAns(2) = "London"
Question(3) = "Where is liberty statue ?" : Ans1(3) = "USA" : WrongAns(3, 0) = "London" : WrongAns(3, 1) = "Dubai" : WrongAns(3, 2) = "India" : WrongAns(3, 3) = "Pakistan" : Clue(3) = "NY" : CorrectAns(3) = "USA"
Question(4) = "In geography where is Mount Fuji ?" : Ans1(4) = "Japan" : WrongAns(4, 0) = "Taiwan" : WrongAns(4, 1) = "China" : WrongAns(4, 2) = "USA" : WrongAns(4, 3) = "Pakistan" : Clue(4) = "It's very small country " : CorrectAns(4) = "Japan"
Question(5) = "What 'L' is an engine for hauling railway trains ?" : Ans1(5) = "Locomotive" : WrongAns(5, 0) = "Load" : WrongAns(5, 1) = "Loose" : WrongAns(5, 2) = "Non of these" : WrongAns(5, 3) = "Late" : Clue(5) = "What's your motive ?" : CorrectAns(5) = "Locomotive"
Question(6) = "If a scooter travels at 20 miles/H,how many miles will it travel in half an hour ?" : Ans1(6) = "10-miles" : WrongAns(6, 0) = "12-miles" : WrongAns(6, 1) = "20-miles" : WrongAns(6, 2) = "5-miles" : WrongAns(6, 3) = "20.5-miles" : Clue(6) = "Some thing devided by 2" : CorrectAns(6) = "10-miles"
Question(7) = "Which london park has an open-air theatre and a zoo ?" : Ans1(7) = "Regent's Park" : WrongAns(7, 0) = "King Park" : WrongAns(7, 1) = "Queen Park" : WrongAns(7, 2) = "Safari Park" : WrongAns(7, 3) = "Zoo Park" : Clue(7) = "'Enter - G' make one word" : CorrectAns(7) = "Regent's Park"
Question(8) = "In science is neon a solid, liquid or gas under normal conditions ?" : Ans1(8) = "Gas" : WrongAns(8, 0) = "Liquid" : WrongAns(8, 1) = "Solid" : WrongAns(8, 2) = "Non of These" : WrongAns(8, 3) = "Powder" : Clue(8) = "We use it every day" : CorrectAns(8) = "Gas"
Question(9) = "On which side of the road do cars drive in Australia ?" : Ans1(9) = "Left" : WrongAns(9, 0) = "Right" : WrongAns(9, 1) = "In-Middle" : WrongAns(9, 2) = "Both" : WrongAns(9, 3) = "Non" : Clue(9) = "What do you think in UK?" : CorrectAns(9) = "Left"
Question(10) = "In sport kung fu is which countries martial art ?" : Ans1(10) = "Chinese" : WrongAns(10, 0) = "Japanese" : WrongAns(10, 1) = "Indian" : WrongAns(10, 2) = "Korian" : WrongAns(10, 3) = "Pakistani" : Clue(10) = "Population is big issue" : CorrectAns(10) = "Chinese"
Question(11) = "In which country would you find the industrial port of Le Harve ?" : Ans1(11) = "France" : WrongAns(11, 0) = "USA" : WrongAns(11, 1) = "China" : WrongAns(11, 2) = "Japan" : WrongAns(11, 3) = "Rusia" : Clue(11) = "Do you remember any Tower...?" : CorrectAns(11) = "France"
Question(12) = "How many wheels does a unicycle have ?" : Ans1(12) = "One" : WrongAns(12, 0) = "Two" : WrongAns(12, 1) = "Three" : WrongAns(12, 2) = "Four" : WrongAns(12, 3) = "Non" : Clue(12) = "It's hard to drive" : CorrectAns(12) = "One"
Question(13) = "In food which fruit is dried to make a prune ?" : Ans1(13) = "Plum" : WrongAns(13, 0) = "Mengo" : WrongAns(13, 1) = "Banana" : WrongAns(13, 2) = "Orange" : WrongAns(13, 3) = "Apple" : Clue(13) = "It's round,sweet and some time it's sour" : CorrectAns(13) = "Plum"
Question(14) = "In which sport are the Ashes a trophy ?" : Ans1(14) = "Cricket" : WrongAns(14, 0) = "Foot Ball" : WrongAns(14, 1) = "Snooker" : WrongAns(14, 2) = "Rugby" : WrongAns(14, 3) = "Hockey" : Clue(14) = "Some time player stand at silly point" : CorrectAns(14) = "Cricket"
Call GetNextQuestion()
lbltime.Text = Format(Time, "dd MMM yyyy")
startTime = DateTime.Now()
Timer1.Start()
End Sub
Private Sub GetNextQuestion()
Dim LB() As Label = {lblA, lblB, lblC, lblD}
Dim J As Integer
Do
N = CInt(Rnd() * 14)
Loop Until Asked(N) = False
Asked(N) = True
lblQuestion.Text = Question(N)
Dim ansWX As String = WrongAns(N, J)
Dim ansWR As String = CorrectAns(N)
'randomize 3 wrong answers
For J = 0 To 3
Do
ansWX = WrongAns(CInt(Rnd() * 14), 3)
Loop Until ansWX <> ansWR And ansWX <> LB(0).Text And ansWX <> LB(1).Text And ansWX <> LB(2).Text
LB(J).Text = ansWX
Next J
'randomize one correct answer
LB(CInt(Rnd() * 3)).Text = ansWR
lblA.BackColor = Color.Beige
lblB.BackColor = Color.Beige
lblC.BackColor = Color.Beige
lblD.BackColor = Color.Beige
End Sub
wating for rep.
thank you
|
|
|
|
|
bapu2889 wrote: here i am posting my code for quiz application and i want to randomize 4 answers 3 wrong and 1 correct answers i manage to randomize correct answer but other three answers are not but it shows three wrong answers but it's from other question
The purpose of using a capital letter at the beginning of a sentence and a period at the end of the sentence is to make it possible to distinguish sentences from each other. The purpose of distinguishing sentences from each other is to make them readable.
When you post code in the forum, use the pre tag to keep the formatting.
---
b { font-weight: normal; }
|
|
|
|
|
ROTFL - we need an English forum. In fact, I think it should be called the Plain English forum, given that it's for basic English questions.
Christian Graus - C++ MVP
|
|
|
|
|
Christian Graus wrote: we need an English forum. In fact, I think it should be called the Plain English forum, given that it's for basic English questions
Just let The Grand Negus know He's in the Suggestions forum going on about advertizing in the sigs
|
|
|
|
|
I've seen that ( it's in the soapbox ), I just regard it as not worth involving myself in.
Christian Graus - C++ MVP
|
|
|
|
|
Christian Graus wrote: I just regard it as not worth involving myself in.
Smart guy
|
|
|
|
|
bapu2889 wrote: Dim Question(14), Ans1(14), WrongAns(14, 3), Clue(14), CorrectAns(14) As String
This is still so, so, totally wrong. You need to put your questions and answer into a struct, so that they are an atomic unit. I told you this before.
bapu2889 wrote: but other three answers are not but it shows three wrong answers but it's from other question
This is why I told you to put them together, I am not surprised.
Christian Graus - C++ MVP
|
|
|
|
|
Can anybody show me how to change the background of selected datagrid cells
Thanks
silver-gray
|
|
|
|
|
The answer you seek rests within the DataGridViewColumn.DefaultCellStyle.BackColor class. Enjoy!
Here's an example I wrote up:
For Each dgvc As DataGridViewColumn In dgvTableList.Columns
If dgvc.HeaderText = "name" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
ElseIf dgvc.HeaderText = "crdate" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
dgvc.DefaultCellStyle.BackColor = Color.Aquamarine
Else
dgvc.Visible = False
End If
Next
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
Is your reply for 2005?? I have 2003.
my 2003 does not know what this is "DataGridViewColumn"
What is the solution in 2003
Thanks
silver-gray
|
|
|
|
|
Um, I don't know what a .NET1.1 solution would be. Sorry.
For what it's worth, my VS2005 Intellisense doesn't pick up "DataGridViewColumn" either. I just ignore the intellisense and keep typing - the code works, but intellisense won't display "DataGridViewColumn" as a class under the namespace.
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
WHAT DO YOU MEAN YOU IGNORE AND KEEP TYPING??
can you show me what it is you are typing ??
Thanks
silver-gray
|
|
|
|
|
Calm down, no need for caps - I'm trying to help you here
I coded this, and it worked as you requested.
For Each dgvc As DataGridViewColumn In dgvTableList.Columns
If dgvc.HeaderText = "name" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
ElseIf dgvc.HeaderText = "crdate" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
dgvc.DefaultCellStyle.BackColor = Color.Aquamarine
Else
dgvc.Visible = False
End If
Next
If that code doesn't work for you, I'm unable to help you any further as I have no experience with .NET prior to the 2.0 Framework.
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
hi there,
i am a newbie. i have seen applications that have one icon which you press to run it. the application contains data which it displays using a search engine. there are no visible data files, so either these files are hidden behind the icon or they are inside the executing file or something i don't know of as i am a newbie.
can a database reside within a .exe file?
how can i do the same? i've got my .exe file and database on the same level of the file hierarchy so i can use a relative path in order for my application to find the db file. it looks much more professional.
zank u
licec
|
|
|
|
|
Normally, you don't have a database in an .EXE unless it's a small one and you don't need to write anything to it.
The database could be in files on the drive, just not in the Program Files\Application folder. It could also be under Program Files\Common Files, or some other place.
If you're using an Access database, you can't put it in a resource in the .EXE. It MUST be in it's own file on the hard drive.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi, i have an application that has the filepaths stored in an access db. what i am having difficulty with is to send a picture to an existing .doc file containing text, which i then want to print.
thanx
licec
|
|
|
|
|
save the image temporary to the win-tmp dir an include it then with the inlineshape-object
myobject.Select
Selection.InlineShapes.AddPicture filename:=filename, LinkToFile:=False, SaveWithDocument:=True
|
|
|
|
|
Hi everyone, i know this is vb.net but i'm working in vb6 for the first time in ages and can't remember how to find the type of object contained in a variant in vb6
What i want to do is have a select case statement so that i can handle each type appropriately
thanks
Russ
|
|
|
|
|
having battled along without any vb help(myMSDN collection has no vb6 references in it) i just realised i could use the VB editor help in office and life is looking better.
TypeName works great, i've been using all sorts to no avail
Russell
|
|
|
|
|