|
ericyeoh wrote: i;m using VB6.0
Why would you do such a thing ? VB6 is obsolete and has been for a long, long time. It ALWAYS was a terrible excuse for a language. Why not use a real language ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
I've never used the speech SDK, yet, 10 seconds with google, and I know that the SAPI SDK contains other voices.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: I've never used the speech SDK, yet, 10 seconds with google, and I know that the SAPI SDK contains other voices.
I understand that the Sapi SDK has other voices but I cannot find them. Any suggestions?
|
|
|
|
|
hi guys
Does anyone know how to retrieve input parameters for a website by using HTTP headers request. I mean what is the code for shown them on a textbox. I have done most of the work for sending requests and getting responses and they work very well except finding the parameters in the content. I recently use Live HTTP headers of Firefox components to get parameters but i don't want to use it any more and code my program to find them. An example, by using Live HTTP headers on google's mail , it retrieves this:
<< HTTP Header>>
POST https://www.google.com/accounts/ServiceLoginAuth?service=mail
Host: www.google.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fhl%3Den%26tab%3Dwm%26ui%3Dhtml%26zy%3Dl&bsv=zpwhtygjntrz&scc=1<mpl=default<mplcache=2&hl=en
Cookie: __utma=173272373.733204749.1223816195.1241322770.1242545301.30; __utmz=173272373.1242545301.30.18.utmccn=(referral)|utmcsr=google.co.nz|utmcct=/|utmcmd=referral; __utma=173272373.733204749.1223816195.1242545301.1255931779.31; __utmz=173272373.1255931779.30.19.utmccn=(referral)|utmcsr=google.co.nz|utmcct=/|utmcmd=referral; __utmc=173272373; GoogleAccountsLocale_session=en; __utmb=173272373; __utma=173272373.733204749.1223816195.1226208114.1227589760.4; GALX=Vq-AnFUU0sE; NID=27=JkcszjpiZcgyP2eZyPvBC5FDlr5ajSyuLl0Xryh_BmZj7nOk3du9zPjp1TPd3jSstVuloQgnbjW7PFJNPtZcM6lrPCDkuGtG--XoVNkneoXnlrkO2loAVCUnOZuNiBv_; PREF=ID=ec0ae488fdcda892:U=77ac6790d8075e61:TM=1237745195:LM=1241223529:GM=1:S=QDdvadqlCz1Tnwy0; rememberme=true; PREF=ID=455fdbe7518f0fd9:TM=1243238393:LM=1243423899:GM=1:S=PY4bydI3x1zVTkG1; GMAIL_RTT=794; TZ=-780; GMAIL_LOGIN=T1255931777004/1255931777004/1255931797099
Content-Type: application/x-www-form-urlencoded
Content-Length: 241
And the content is :
ltmpl=default<mplcache=2&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fhl%3Den%26tab%3Dwm&service=mail&rm=false<mpl=default&hl=en<mpl=default&scc=1&GALX=Vq-AnFUU0sE&Email=&Passwd=&PersistentCookie=yes&rmShown=1&signIn=Sign+in&asts=
how does it work to get the above content and how i can code my program to show them?
|
|
|
|
|
Hi all.
I am creating a program in which I am searching some files from database (MS-Access) and displaying it on Listview control.
When I am using a single form for searching and displaying then code works but I want to scan files from one form and display those items on another form, but it not working.
The code I am using is as below in frmScan:
Private Sub BGWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BGWorker.DoWork
For Each file As String In My.Computer.FileSystem.GetFiles("c:\", FileIO.SearchOption.SearchAllSubDirectories)
'Check for cancelation of Background worker.
If BGWorker.CancellationPending Then
e.Cancel = True
Exit Sub
End If
Dim extn As String = IO.Path.GetExtension(file)
Try
Dim sql As String = "Select * from ThreatType"
Dim cmd As New OleDb.OleDbCommand(sql, con)
ThreatDatabase.Connect()
Dim reader As OleDb.OleDbDataReader = cmd.ExecuteReader
While reader.Read
If extn.ToUpper = reader.GetString(0) Then
If IO.Path.IsPathRooted(file) Then
Me.RefreshList(file, reader.GetString(1)) 'cross-threading
End If
End While
reader.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
End If
Next
End Sub
Delegate Sub UpdatetList(ByVal [Name] As String, ByVal [Type] As String)
Private Sub RefreshList(ByVal [Name] As String, ByVal [Type] As String)
If frmMain.ListView1.InvokeRequired Then
Dim d As New UpdateList(AddressOf RefreshList)
frmMain.ListView1.Invoke(d, New Object() {[Name], [Type]})
Else
frmMain.ListView1.Items.Add([Name]).SubItems.Add([Type])
End If
End Sub
In RefreshList code block, When I am using
Me.ListView1 instead of
frmMain.ListView1 then it shows file on listview of same form but I want to display files on listview of frmMain.
Suggest me how can I do this.
Thanks.
Gagan
|
|
|
|
|
Where does frmMain come from ? What do you mean by 'not working' ? What happens ? Did you want help ? You seem to be setting a puzzle rather than giving us the info we need to try to help here.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I wanted to create an app to incorprate on my program where the user has to type in a serial number before the applicaion is then displayed. Then when the application is then re-run the serial number form is NOT shown due to the serial number having already been inputted.
I will be honest i am not the greatest programmer so bear with me.
Here is the code i have currently used howver this HALF works.
This will allow the user to enter the serial code and show form 2 however when the user re-runs the app then it doesn't run?!?! The form flashes up for .1 of a second and then disappears.
Public Class Form1
Dim FILE_NAME As String = ("serial.txt")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do Until objReader.EndOfStream
If txtserial.Text = objReader.ReadLine Then
Startnot.Checked = False
Form2.Show()
Me.Hide()
Else
Try
If txtserial.Text = objReader.ReadLine.Trim Then
End If
Catch Ex As Exception
End Try
Label1.Text = "Invalid CDKey"
End If
Loop
objReader.Close()
End Sub
Private Sub Form1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
If Me.Visible = False Then
Form2.Show()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetAttr(FILE_NAME, FileAttribute.Normal)
Dim Dontshow As Boolean
Dontshow = GetSetting(My.Application.Info.ProductName, "Options", "Dont Show Me", 1)
If Dontshow = 0 Then
Form2.Show()
Call cookies()
Exit Sub
End If
Startnot.Checked = True
End Sub
Private Sub Startnot_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Startnot.CheckedChanged
SaveSetting(My.Application.Info.ProductName, "Options", "Dont Show Me", Startnot.CheckState)
End Sub
Private Sub cookies()
Me.Close()
My.Forms.Form2.Show()
End Sub
End Class
I got some previous feedback from another programmer saying
I'd start by scrapping what you have and replacing it with a seperate class. You main form should call this class, call it "Licensing", to ask if it is OK to run the app. The Licensing class has to do a few things to answer this question.
First, it has to check to see if the app has already been through the CDKey entry process and that a valid Key was entered. This could be a value written to the registry or to your AppSettings file.
If the value doesn't exist or it indicates that the license is not valid, this class would put up a new form, or even just an InputBox, asking for the CD key. Once the key is entered, it is compared against the first line of the serial.txt file. If they match, then you create/update the value tracking this in the Registry or your AppSettings file. If not, then Licensing doesn't change anything and returns False to say that it is not OK to run the app.
If the value is OK, then the method in your Licensing class would just return True to say that it is OK to run the app. There's no need to put up the CD Key entry form again.
You can get the first line of the file using:
Dim keyInFile As String ... Using sr As New StreamReader(Path.Combine(Application.StartupPath), "serial.txt")) keyInFile = fs.ReadLine() End Using
howeve i am ereally struggaling to incorprate this code so if any body could help me fix this then that would be very nice.
Many thanks
Dan
|
|
|
|
|
This looks like a disaster. Have you tried setting breakpoints in your code to see what happens that second time ? Can you give us some more specific diagnostics ?
Obviously, this is all just for fun and learning, so I won't comment again on how utterly useless your 'protection' is.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Have you tried setting breakpoints
breakpoints, the points where you see your code break as you stare at the screen?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Seems that way.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Only if you manage to compile it
|
|
|
|
|
thanks guys for all the replies. Ummm break points? I just copied and pasted the ALL the code that i used
|
|
|
|
|
Hi,
I have written a macro that sends email from MS Excel through MS Outlook. The action is triggered by a button-click. Now, the same macro does not work when I'm using Outlook Web-access. Does anybody know how I can send email from MS Excel through outlook web-access? I need help badly.
Thanks in advance .
|
|
|
|
|
With extreme difficulty. AFAIK, there is no component to interact with OWA.
|
|
|
|
|
I use DataGridView with column type CheckBox. How to verify whether CheckBoxs in this column is checked
|
|
|
|
|
Get the CheckBox cell and inspect its checked property. A bit more explanation of your problem would help.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
How to inspect. Give me some example
|
|
|
|
|
ivo75 wrote: How to inspect
The checked property is a boolean. Put that in a if/else block and see if it is true or false. Not a VB guy hence cannot provide the code. Even if I was, I wouldn't have since I do not believe in spoon feeding at professional level (Hope you are a professional and not a student).
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
test whether the checked property is true to do whatever you want
|
|
|
|
|
Hello,
I am programming in vb.net 2005
I have two classes: Point and Line
My application is drawing ~30 to 50 lines on a picturebox.
I don't know if it is possible but I am trying to add an eventhandler to allow user to click on specific line and then to change the color of selected line.
I can't success to give to this line object a click event ability.
Is it possible?
How to do it?
Here is my snippet code:
Option Explicit On
'********START POINT*******************
Public Class MainForm
Private Line1 As Line
Private Sub MainForm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim P1 As New Point(10, 30), P2 As New Point(120, 210)
Line1 = New Line(P1, P2)
Line1.DrawLine(e)
AddHandler Line1.LineClick, AddressOf LineClicked
End Sub
Private Sub LineClicked(ByVal sender As Object, ByVal e As EventArgs)
'Do something
End Sub
End Class
'********DELEGATE*******************
Public Delegate Sub LineEventHandler(ByVal sender As Object, ByVal e As EventArgs)
'********LINE CLASS*******************
Public Class Line
Inherits EventArgs
Private P1 As Point, P2 As Point
Sub New(ByVal P1 As Point, ByVal P2 As Point)
Me.P1 = P1
Me.P2 = P2
End Sub
Sub New(ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single)
Me.P1 = New Point(x1, y1)
Me.P2 = New Point(x2, y2)
End Sub
Public Sub DrawLine(ByVal e As PaintEventArgs)
Dim p As New Pen(Color.Black, 1)
Dim g As Graphics = e.Graphics
g.DrawLine(p, P1.x, P1.y, P2.x, P2.y)
End Sub
Public Event LineClick As LineEventHandler
Protected Overridable Sub OnLineClick(ByVal e As EventArgs)
RaiseEvent LineClick(Me, e)
End Sub
End Class
'********POINTC CLASS*******************
Public Class Point
Public x As Single, y As Single
Sub New(ByVal x As Single, ByVal y As Single)
Me.x = x
Me.y = y
End Sub
Property xCoord() As Single
Get
Return x
End Get
Set(ByVal value As Single)
x = value
End Set
End Property
Property yCoord() As Single
Get
Return y
End Get
Set(ByVal value As Single)
y = value
End Set
End Property
End Class
Shay Noy
|
|
|
|
|
Well, there are a few problems here. Your class line does not need to inherit from EventArgs. Instead it should inherit from Control/Usercontrol class since controls raise event. Next, the EventArgs can be replaced by LineClickEventArgs and that class should inherit from EventArgs class. This class should have properties that the parameter should provide. Then, you need to have a virtual overridable method say OnLineClick which should take in LineClickEventArgs as the parameter.
The only thing that remains now is that from where will you call OnLineClick. For this, you will need to identify if the click was on the line. You can have some property that will be set when you click the line. And in the set block, you can call the OnLineClick method.
AFAIK you can get to know if the line was clicked only in the MouseDown/MouseUp of your form. And there you can change the property of the Line class which will raise the event.
Other way of changing the line color can be this:
1. In the MouseDown/MouseUp event of the form, see if click was on line.
2. Have a flag say IsLineClicked in your form.
3. Add a bool parameter in your DrawLine and in the method have an if else that will set the color in which line will be drawn.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
Welcome.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I have written a program in VB 2008 Express to call up my ADSL Router, login, access and save some traffic statistics. The partial code shown below has been gleaned from the interent/forums as a means to automatically login to the router. Unfortunately, this routine does not work. When the webbrowser1.navigate command is issued the router responds with another form requiring the login user name and password (these are required in unencrptyed text). The document.completed event is never reached as control is taken away from my program and held by the Internet Explore pop up page. I have tried a number of ideas but cannot overcome this proble. Is there an experienced coder who can offer some valuable advise please ?
code:
Imports System
Imports System.Net
Public Class Form1
Dim username, pswd As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Part 1: Use WebBrowser control to load web page
WebBrowser1.Navigate("http://192.168.1.1/")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
username = "admin" : pswd = "admin"
' Part 2: Automatically input username and password
Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")
For Each curElement As HtmlElement In theElementCollection
Dim controlName As String = curElement.GetAttribute("name").ToString
If controlName = "username" Then
' curElement.GetAttribute("Value")
curElement.SetAttribute("Value", username)
ElseIf controlName = "password" Then
curElement.SetAttribute("Value", pswd)
End If
Next
' Part 3: Automatically click the Login button
Dim theWElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")
For Each curElement As HtmlElement In theWElementCollection
If curElement.GetAttribute("value").Equals("Login") Then
curElement.InvokeMember("click")
' javascript has a click method for we need to invoke on the current submit button element.
End If
Next
End Sub
End Class
|
|
|
|
|