|
kenn_rosie wrote: so I was wondering if I have to write code that causes the sub application_start to start?
No, but unless you restart IIS, this code won't run. It gets run when IIS starts.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hmm, so How do I get it to work to send out email without restarting IIS, That seems strange? If I want the email to go out daily, do I need to have a trigger or something to restart IIS all the time?
|
|
|
|
|
No need to restart IIS daily for purpose of sending mail .Restarting IIS means restarting application .
If you want to automatically send email daily , then create a small exe In which can be scheduled to run once in a day .This exe can be created in vb / vb.net .
Divya Rathi
|
|
|
|
|
My application is going to move some files when a button is clicked.
If the file is opened by other application,
my system.io.file.move(file) will have exception,
How can I detect the file is opened by other application before the move action?
Thanks.
|
|
|
|
|
Catch the exception.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I know this method, but any other way?
|
|
|
|
|
No.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Catching the Exception is the only way to get feedback that a file is open and can not be moved...
What you need to do is loop throuhg the files you are moving and when it hits a locked file it keeps trying till it can.
<br />
Dim bIOEx As Boolean = True<br />
Try<br />
If blnMove = True Then<br />
Do<br />
Try<br />
System.IO.File.Move(strOriginalFile, strDestinationFile)<br />
bIOEx = False<br />
<br />
Catch ex As IOException<br />
bIOEx = True<br />
End Try<br />
Loop Until bIOEx = False<br />
End If<br />
Catch ex As Exception<br />
MessageBox.Show("The File Redirection Failed" & vbCrLf & ex.Message, "Move Error", MessageBoxButtons.OK, MessageBoxIcon.Warning)<br />
Finally<br />
blnMove = False<br />
End Try<br />
You may want to do a loop count that times out after 3 tries 10 seconds apart.
Hope this helps...
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
I am new at vb.net and would like to know
What object is streamwriter located under?
Is it a function or sub routine?
VS 2003:
I have a project with the folowing in code behind:
Dim sw As StreamWriter
I thought maybe I could drill down in the objects and find it.
I assume that is under System.IO?
I did an Ctrl ALT J in visual studio to look at the classes
and I cannot drill down to streamWriter?
Where can I find where streamwriter is located?
|
|
|
|
|
|
I was trying to drill down to it in visual studio but It does not drill down very far in system.io for visual studio.
Unless I am doing something wrong?
|
|
|
|
|
kenn_rosie
Do you have "system" referenced in the solution explorer?
progload
|
|
|
|
|
Thanks, I found it, I expanded mscorlib and there it was
|
|
|
|
|
Hi, I am programming a tcp messanger with ips. this is my coding for the server!
THE PROBLEM IS THAT WHEN I MAKE PORT 5000 OR ANY OTHER NUMBER IT CRASHES AND TELLS ME THAT IT MUST BE PERFORMED BY 1 TIME ONLY! SOCKETERROR
listener = New TcpListener(5000)
listener.Start()
THIS IS MY WHOLE CODING FOR THE SERVER
Imports System.Threading
Imports System.Net.Sockets
Imports System.IO
Imports System.Windows.Forms
Public Class frmServer
Inherits Form
Private connection As Socket
Private readThread As Thread
Private socketStream As NetworkStream
Private writer As BinaryWriter
Private reader As BinaryReader
Private Sub frmServer_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
System.Environment.Exit(System.Environment.ExitCode)
End Sub
Private Sub txtOut_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtOut.KeyDown
Try
If (e.KeyCode = Keys.Enter AndAlso Not connection Is Nothing) Then
writer.Write("Server>>> " & txtIn.Text)
txtOut.Text &= vbCrLf & "Server>>> " & txtIn.Text
If txtIn.Text = "Terminate" Then
connection.Close()
End If
txtIn.Clear()
End If
Catch ex As SocketException
txtOut.Text &= vbCrLf & "Error writing object"
End Try
End Sub
Public Sub RunServer()
Dim listener As TcpListener
Dim counter As Integer = 1
Try
listener = New TcpListener(5000)
listener.Start()
While True
txtOut.Text = "Waiting for connection" & vbCrLf
connection = listener.AcceptSocket()
socketStream = New NetworkStream(connection)
writer = New BinaryWriter(socketStream)
reader = New BinaryReader(socketStream)
txtOut.Text &= "Connection " & counter & " recieved." & vbCrLf
writer.Write("Server>>> Connection Successful")
txtIn.ReadOnly = False
Dim theReply As String = ""
Try
Do
theReply = reader.ReadString()
txtOut.Text &= vbCrLf & theReply
Loop While (theReply <> "Client>>> Terminate" AndAlso connection.Connected)
Catch ex As IOException
MessageBox.Show("Client application closing")
Finally
txtOut.Text &= vbCrLf & "User terminated connection"
txtIn.ReadOnly = True
writer.Close()
reader.Close()
socketStream.Close()
connection.Close()
counter += 1
End Try
End While
Catch ex As IOException
MessageBox.Show("Server application closing")
End Try
End Sub
Adrian De Battista
-- modified at 18:26 Tuesday 21st February, 2006
|
|
|
|
|
I have written a very simple vb.net app to look at some properties in an msi file. Whenever I execute the msiInstall = CreateObject("WindowsInstaller.Installer") statement I get the error: Cannot create ActiveX component. I have added a reference to the Microsoft Windows Installer module and msi.dll is definately registered on my system. I have declared the msi object using Dim msiInstall As WindowsInstaller.Installer.
When I run the same bit of code in VBScript I do not get this error so it must be something in my VS 2003 configuration.
This is the complete error with details when I compile and run the exe:
************** Exception Text **************
System.Exception: Cannot create ActiveX component.
at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName)
at UpdateVers.Form1.btnUpdateMin_Click(Object sender, EventArgs e) in C:\VB\UpdateVers\UpdateVers\UpdateVers\Form1.vb:line 95
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
UpdateVers
Assembly Version: 1.0.2243.29760
Win32 Version: 1.0.2243.29760
CodeBase: file:///C:/VB/UpdateVers/UpdateVers/UpdateVers/obj/Debug/UpdateVers.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
Interop.WindowsInstaller
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/VB/UpdateVers/UpdateVers/UpdateVers/obj/Debug/Interop.WindowsInstaller.DLL
|
|
|
|
|
Hi,
i want to create a multiple datasets and bind it seperately. the query will look like
select * from table where id=ID
now,
if id = 1,
i want to generate dataset1 just for records with id=1 and
if id = 2,
i want to generate dataset2 just for records with id=2 and so forth
so that i can bind those datasets to different web control say for webchart component or a datagrid.
hope my question makes sense.
please help!!!
Robin
|
|
|
|
|
no problem dude.
just create 2 query n store them in 2 seperate variable.
say
Dim q1 As String="SELECT * from table WHERE id=2"
Dim q2 As String="SELECT * from table WHERE id=2"
Dim cmd1 As New SQLCommand(q1,conn) 'conn is ur connection
Dim cmd2 As New SQLCommand(q2,conn)
Dim da1 as New SQLDataAdapter
Dim da2 as New SQLDataAdapter
da1.selectCommand=cmd1
da2.selectCommand=cmd2
Dim ds1 As New DataSet
Dim ds2 As New DataSet
da1.Fill(ds1)
da2.Fill(ds2)
' ur dataset populated
' show them
DataGrid1.DataSource=ds1
DataGrid2.DataSource=ds2
Hope that helps.
this is not the end, this is how its goin to begin !
|
|
|
|
|
Does anybody know if there is a function
like the one in excel for vlookup.
;);P
|
|
|
|
|
Dim lookupTable As New HashTable
lookupTable.Add("KeyName", "Value")
lookupTable.Add("KeyName1", "Value1")
lookupTable.Add("KeyName2", "Value2")
lookupTable.Add("KeyName3", "Value3")
Dim value = lookupTable.Item("KeyName")
My Blog[^] FFRF[^]
|
|
|
|
|
I am creating a simple form that requires additional information before being displayed.
What I want to do:
Override ShowDialog(owner) with ShowDialog(owner, string0, string1) As DialogResult
That part is easy.
What I want to do is prevent the use of ShowDialog() and ShowDialog(owner).
Naturally, there are many ways to accomplish what I am trying to do, but I really want to know If I can do this. Is there a way to override these methods (or some other way) so that thay may not be called on my custom dialog?
Thanks
-mE
|
|
|
|
|
Guess I didn't pound my keyboard long enough. Kept looking and I found it. Use "shadows" instead of "overrides" and it does exactly what I wanted.
-mE
|
|
|
|
|
I use DB2 under AS/400 and the “SLTFORMULARIO_MG” stored procedure really exists.
Ok... because we don’t have that much time to spend, I tried another solution. I did remove the link between the stored procedure and the RPT file and so, I did set up one xml datasouce. So, I putted the stored procedure returns into a dataset and did use as:
<br />
oRpt = New ReportDocument<br />
oRpt.Load(_sFileRPT)<br />
<br />
oRpt.SetDataSource(_dtDados)<br />
Ok, the code ran nice and quickly, but because I can go to heave straightway. I still have a problem when using formulae to perform calculation. I got this damn error:
MENSAGEM DE ERRO:
A number, or currency amount is required here.
Error in File C:\DOCUME~1\BRRIOW~1\ASPNET\LOCALS~1\Temp\PEDIDO_SA {8885AC00-192E-4A1D-9E2A-A38289AEA818}.rpt:
Error in formula <UNITxVALOR>.
' ({SLTFORMULARIO_SA.PRECO_UNIT}) * {SLTFORMULARIO_SA.QTD_PEDIDA} '
A number, or currency amount is required here.
STACK TRACE:
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
Right, Right, I did many tests and when I changed the code from:
({SLTFORMULARIO_SA.PRECO_UNIT}) * {SLTFORMULARIO_SA.QTD_PEDIDA}
To:
({SLTFORMULARIO_SA.PRECO_UNIT}) + {SLTFORMULARIO_SA.QTD_PEDIDA}
It was fine, except from the fact that it was catenated instead of added.
Anyone could, please, help me up?
|
|
|
|
|
I am attempting for the first time to link Crystal reports with VB.Net and having a wee bit of trouble. I have provided some code I have done but for some reason it is not recognising....
Dim cr As New ReportDocument
What reference have I missed out and what is the best way to do such a thing. Any help, ideas would be gratefully appreciated.
Dim DA As OleDb.OleDbDataAdapter
Dim DS As New DataSet
Dim strSQL As String
strSQL = ""
strSQL = "SELECT EmployeeID, LastName, FirstName FROM EMPLOYEES"
DA.Fill(DS, "Employees")
'Verify the path to the Crystal Report's .RPT file
Dim strReportPath As String = "C:\Temp\crystalreport1.rpt"
'Load the Crystal report's .rpt file and pass in the data table
Dim cr As New ReportDocument
cr.Load(strReportPath)
cr.Setdatasources(DS.Tables("Employees")
|
|
|
|
|
Using the MAPI control to send email with outlook is easy enough to set up, but whatever you send as body text gets sent as-is. I am trying to get HTML to work in the messages i send, but it seems outlook will paste the message into the text section, and will not update the source section. As i am attempting to make a program for easy email generation for a email based game, i need some way for it to generate the email with the html in-tact. does anyone know any way of doing this.. there is a MsgType command, i beleve, but VB does not show a list of what can be typed after it to modify it, where it is just a control.
"Love, Life and Option Explicit"
|
|
|
|
|
How do I make a program that search through a site(like http://www.codeproject.com) and if a word is on that site it displays a messagebox(if the word new is in line 6 of http://www.codeproject.com the script msgbox ("There is something new!!!" , , "NEW") comes)
Thanks
|
|
|
|