|
I've partly solved it!
Just realised that the printer I was selecting isn't the model installed - it's one we don't use anymore and the model numbers are so similar I didn't realise.
However, this fails to explain why the Dialog box fails to pick up the real printer that is attached and works from other apps!!
Rich
|
|
|
|
|
Hi can any one tell me how to show only one open window of the application even if it contains multiple windows.
Example i have 5 forms in the project and when i open the form while running it shows multiple opened windows on the taskbar, where as i need only 1.
Jats
|
|
|
|
|
If you go to the design view of your form theres a ShowInTaskbar Option, set it to False for the Forms you dont want to show in the Taskbar.
" In the next millennium there are two kinds of business, those on the Internet and those out of business"
Bill Gates
"Be nice to nerds. Chances are you'll end up working for one."
Bill Gates
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
Have you seen the ShowInTaskbar property of the Form class?
Dim newForm As New Form2
newForm.ShowInTaskbar = False
newForm.Show()
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
hi jats
First u decide which form's title must be show in task bar .
if u want to show same form title for all condition, then change the property ShowInTaskBar to false for all other remaining form.
and if u want to show different title for different form at the base of active form(but have only one window in task bar) then set ShowInTaskBar property to false for all other form at load event of present active form.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
Hi there,
I have a VB MFC that uses a dll for sending, receiving, dispalying and logging data from/to another application the problem is that SOMETIMES when I close the VB window by clicking on X the application goes off ( you do not see it on desktop) but when you open the task manager, you can see that the application is still there. The problem is that it happens just sometimes. Any ideas?
It is the way I close the appliaction:
Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Are you sure you want to Exit the application?", vbYesNo + vbQuestion, "Application") = vbNo Then
Cancel = True
End If
End Sub
Private Sub MDIForm_Terminate()
fnWEHostShtdn
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
If Me.WindowState <> vbMinimized Then
SaveSetting App.Title, "Settings", "MainLeft", Me.Left
SaveSetting App.Title, "Settings", "MainTop", Me.Top
SaveSetting App.Title, "Settings", "MainWidth", Me.Width
SaveSetting App.Title, "Settings", "MainHeight", Me.Height
End If
End Sub
The other question is that how I can check if an application is running and if for any reason (even a hard close by user) the application is closed, it reopens itself.
Thanks in advanced.
Nahitan
|
|
|
|
|
This is usually caused by an improper shutdown of a component in your app. Most likely, this would be the .DLL you're using. It's possible that it created a seperate thread(s) that are still running when your app quits. You'll have to check with the docs or anything else you can find on this library and see if it needs you to do anything special to shut it down before your app closes.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks for the reply, but when you want purposely close the application, is it the VB application responsible for that or the dll application which is written in C++ and has many threads?
Thanks
|
|
|
|
|
Yes! Any .DLL you load becomes a part of your code, not a seperate process. This is a curious question, because throughout all coding, if your code creates or loads something, your code is also responsible for managing and destroying that something properly.
Making the assumption that an object or runtime can clean itself up without you telling it to do so is a very bad thing to do. This practice leads to unstable applications and operating systems. For instance, if you application creates a Graphics object, you are also responsible for destroying it when your done with it. If not, you'll eventually run the system out of resources and crash the whole operating system.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I need to call Outlook Compose mail box, By inserting subject and mail Id and show it to the user.
I can make it up to calling the outlook.exe but cannot call compose mail box directly.
Please help...
Jats
|
|
|
|
|
I'm not an expert but I use this:
<code>
Dim oOutlook As New Outlook.Application
Dim oMailitem As Outlook.MailItem
Dim oAttach As Outlook.Attachment
oMailitem = CType(oOutlook.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
oMailitem.To = "Jack <jack@isp.co.za>"
oMailitem.Subject = "Your Subject "
oMailitem.Body = "Hello, "
oMailitem.Display()
'oMailitem.Send()
</code>
I take it you already have references to Outlook.
Hope it helps
|
|
|
|
|
Thankx a lot for your help!!!
The code is perfect...i did it before but missed a line
Can you please tell me how to add multiple lines in the body, One line after the other, should i use some thing like or \n.
Jats
|
|
|
|
|
Hi dont mind i got it.
Thankx again!!!
Jats
|
|
|
|
|
hi jats use following code
pass required argument to following function
Function MailComponent(ByVal mailTo As String, ByVal cc As String, ByVal Bcc As String, ByVal subject As String,byval bodyofMessage as string)
Dim str, body As String
str = ""
If bodyofMessage Is Nothing Then
body = bodyofMessage
End If
If cc Is Nothing Then
cc = ""
End If
If Bcc Is Nothing Then
Bcc = ""
End If
If subject Is Nothing Then
subject = ""
End If
'string builder used for concatination
Dim MsgBuilder As New System.Text.StringBuilder
MsgBuilder.Append("mailto:" & mailTo)
If Not cc.Trim = "" Then
MsgBuilder.Append("&cc=" & cc)
End If
If Not Bcc.Trim = "" Then
MsgBuilder.Append("&bcc=" & Bcc)
End If
If Not subject.Trim = "" Then
MsgBuilder.Append("&subject=" & subject)
End If
If Not Body.Trim = "" Then
MsgBuilder.Append("&body=" & Body)
End If
If Not Attachment.Trim = "" Then
MsgBuilder.Append("&Attach=" & Attachment)
End If
'Debug.WriteLine(MsgBuilder.ToString)
ExecuteFile(MsgBuilder.ToString)
End Function
Function ExecuteFile(ByVal FileName As String) As Boolean
Dim myProcess As New Process
myProcess.StartInfo.FileName = FileName
myProcess.StartInfo.UseShellExecute = True
myProcess.StartInfo.RedirectStandardOutput = False
myProcess.Start()
myProcess.Dispose()
End Function
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
Thankx for the help, i got it.
Jats
|
|
|
|
|
Hi
I need very urgent this requirement
i have tio implement in my project
I have implemented httpwebrequest through access the web pages
I want to login to home page using webrequest. it successfully logged into the site but it is unable to showing in web browser , it says session expired.
just see below example if have any solution give me reply
very urgent plz........................
thxadvance
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim query As String = "email=sams@sdd.com&password=regards &commit=Login&loginType=emp"
Dim url2 As String = "sourceurl"
Dim url3 As String = "target / home page url"
Dim src As String = ""
src = readHtmlPage(url2, query, url3)
src = getpage(url3)
WebBrowser1.Navigate(url3)
End Sub
Public Function getpage(ByVal strurl As String) As String
Dim responseData As String = ""
Dim responseReader As StreamReader
Try
webRequest1 = WebRequest.Create(strurl)
webRequest1.Timeout = 30000
webRequest1.Method = "GET"
responseReader = New StreamReader(webRequest1.GetResponse.GetResponseStream)
responseData = responseReader.ReadToEnd
responseReader.Close()
Catch ex As Exception
MessageBox.Show(ex.Message.ToString, "vcv", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Return responseData
End Function
Function readHtmlPage(ByVal url As String, ByVal strpost As String, ByVal url1 As String) As String
Dim result As String = ""
Dim myWriter As StreamWriter
Dim objRequest As HttpWebRequest = WebRequest.Create(url)
objRequest.Method = "POST"
objRequest.ContentLength = strpost.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
objRequest.CookieContainer = New CookieContainer
Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(strpost)
Catch e As Exception
Return e.Message
Finally
myWriter.Close()
End Try
Dim objResponse As HttpWebResponse = objRequest.GetResponse()
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
WebBrowser1.Navigate(url1)
sr.Close()
Return result
End Function
|
|
|
|
|
Hi
How do you overwrite bytes in a certain position in a file in VB.Net/VS2003.
|
|
|
|
|
This is covered by the FileStream[^] class. You usually open the file, Seek to the position you want to overwrite, then Write the new data.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
What type of file is this? If it is text, you dont have a choice but to read out the whole file, change the characters that you want to, and write it all out again.
|
|
|
|
|
Hi
It is a midi file...
The header is mixed as follows:
A 4-byte chunk type (ascii)
A 4-byte length (32 bits, msb first)
length bytes of data
(I will only be able to check if you reply in the morning)
|
|
|
|
|
RichardBerry wrote: It is a midi file...
The header is mixed as follows:
A 4-byte chunk type (ascii)
A 4-byte length (32 bits, msb first)
length bytes of data
In that case, please look at Dave's suggestion above.
Keep in mind that the number of bytes you want to write should match the number you are overwriting, though
|
|
|
|
|
hi everybody,
i want to call a function from c++ dll. previously it was working fine. but now i have added unicode support to it. it works fine if _UNICODE is not defined in c++ dll. but if i define _UNICODE it gives error that Can't find DLL entry point . what i am missing.
Thanx in advance.
|
|
|
|
|
Without seeing your function header, it's impossible to tell. You might want to ask this question in the C++ forums.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi
How do you rename a file in vb.net?
(I don't ewant to open the file and Save it as osmething else - just rename)
|
|
|
|
|
Try this:
Imports System.IO
File.Move(oldfilename, newfilename)
NOTE you need to include the path in the filenames above.
Hope that helps.
Ben
|
|
|
|