|
I don't believe you can start a printer in ASP.NET, the user has to do it in the browser.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian
Thanks for your reply.
Can I do it using VB.NET?
Dave
|
|
|
|
|
If you're not using ASP.NET. The problem is that ASP.NET runs on the server and generates HTML for a browser. If you're writing a winforms app, then you're running on the machine you want to print on, that's fine. HEaps of tutorials on the web.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Guys,
Quick one (yeah I smell that too )
I got this pimped out treeview that handles drag'n'drop by itself etc.
It raises 'Before...' events during the d&d cycle because i want to be able to disallow some actions based on the node being affected.
This way I can have much cleaner code and all checks in the actual app will be kept to a minimum.
Now, the problem is that if i choose to cancel an action based on the data the 'Before' event passes to it's handler I need to do something like:
<br />
Sub ...(Node as TreeNode)... handles MyTreeview.BeforeNodeDrag<br />
<br />
if Node ...... then<br />
'I set a custom property of the treeview<br />
'the tree will check the .Allowdrag before it executes DoDragDrop<br />
MyTreeview.AllowDrag = False<br />
....<br />
end if<br />
<br />
end sub<br />
Once the control is passed back to the tree's d&d events drag will be terminated. This works fine and is rather clean too.
BUT
I want to know how I can pass a param back to the treeview with the one of the BeforeNodeDrag params.
For instance, If you look at the QueryCountinueDrag event in a treeview there e.Action can be set to Cancel and once the procedure is exited d&d is aborted.
Can this be done?
Thanking in advance
Regards
Alex
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
Anyone?
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
This can be done only if the control supports it. Since we nothing of the controls you're using (it's not Microsoft's) there's no way to tell if it does.
Basically, it would work just like, say, the Form's Closing event. There is a CancelEventArgs object that is sent to the event handler your write. If you want to cancel closing the form, you set its Cancel property to True sometime before control is passed back to the event source.
Private Sub Form1_Closing(sender As Object, e As CancelEventArgs) Handles MyBase.Closing
' Cancel the Closing event from closing the form...
e.Cancel = True
End Sub
You MAY be able to add this support if you create your own version of that treeview control and override the sub that raises this event, if there is one. You'd have to provide the new custom event code and the code to handle the parameter you want to pass. But it depends on the control and what you want to do with that data your passing back.
For example, in the Form class, there's a sub called OnLoad that raises the Load event that you handle in your code. You'd have to override the OnLoad sub if you wanted to do something different, like what you're talking about, passing a parameter back to the OnLoad sub.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
It's a pain but it seems like the right way to solve the issue.
Thanks a lot for the tip Dave
Regards
Alex
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
Hi !!
I have a software developed using VB 6.0 and SQL server 2000.During the development stage we gave (hard coded) the server name as "SERVER1".But when I ran the same project on another m/c the DB doesn't get connected.The other m/c is having local SQL server.
What will be the problem.Whether I'll have to change the code or the SQL server settings or both.
Plz help me out.
Thanx & Regards.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
Hi All
Windows operating systems are allowed to create zip archives without having WinZip installed.
Do you know a way to create them using .Net 2.0?
I thought that can be possible using GZipStream and DeflateStream classes; I tryed, but no success.
How can we do them?
Regards Manustone
<br />
Imports Microsoft.VisualBasic<br />
Imports System<br />
Imports System.IO<br />
Imports System.IO.Compression<br />
<br />
Module TestZip<br />
Sub Main()<br />
Console.WriteLine ("*** TEST ***")<br />
<br />
try<br />
dim fs as FileStream<br />
<br />
fs = new FileStream( "FileToZip.txt", FileMode.Open, FileAccess.Read, FileShare.Read )<br />
dim bs(fs.Length - 1) as Byte<br />
fs.Read( bs,0,bs.Length )<br />
fs.Close<br />
<br />
fs = new FileStream( "FileZipped.zip", FileMode.Create )<br />
dim gz as GZipStream<br />
gz = new GZipStream( fs, CompressionMode.Compress,true )<br />
gz.Write( bs,0,bs.Length )<br />
gz.Flush()<br />
gz.Close()<br />
<br />
catch ex as Exception<br />
Console.WriteLine( ex.Source )<br />
Console.WriteLine( ex.Message )<br />
end try<br />
<br />
End Sub<br />
End Module<br />
|
|
|
|
|
Hi,
I have some webservice running on windows 2003 machine over SSL (Does not require client certificate. SSL, just to encrypt the data).
I made a client in VB6 which uses Soap Toolkit 3 to access the webservice.
Everything works fine if I use the client on windows2003 or windows XP machine. Client can deal with the webserice using "https" URL.
But, when I tired running the client over win2000 machine, it gave me following error.
---
Connector:Unspecified HTTP error. HRESULT=0x800A1518 - Client:An unanticipated error occurred during the processing of this request. HRESULT=0x800A1518 - Client:Sending the Soap message failed or no recognizable response was received HRESULT=0x800A1518 - Client:Unspecified client error. HRESULT=0x800A1518
----
Then I changed the code so that it references the webserice with "http". It worked.
Then what I figured out is..
On win2000 machine when I wrote the url with "https" in browser, I got security warning "u r about to see secure item". This warning was not seen when I wrote the URL in win2003 and XP. So, I think the Soap Toolkit can not deal with that security warning?
Can anybody tell me how to solve this?
Any help will be appreciated.
- PPT
|
|
|
|
|
I had a Question I was hoping you might be able to help me with.
I am using VB.NET 2005 express and I have a list box that is bound to a table in a dataset. I want to be able to select one of the items in the list box and then use an item that corresponds to this item in the list box and I do not know how to do this.
For example, if I had a table named Person and this table had two fields one named PersonID (which is the key field), PersonName, and PersonAge. Say I had PersonName bound to the list box. So say I click on one of the PersonNames in the list box and then wanted to use the PersonAge, which corresponded to the name I had clicked, in a calculation. How would I access the PersonAge value?
I appreciate any help you could give me.
Thanks
|
|
|
|
|
Bind your datatable like this:
ListBox1.DisplayMember = "PersonName"<br />
ListBox1.ValueMember = "PersonAge"<br />
ListBox1.DataSource = dtMyDataTable
And then refer to the ListBox1.SelectedValue to get the person's age.
Hope this helps.
|
|
|
|
|
|
Probably permissions, although you don't provide a lot of info. Can you read the file normally ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello,
I thought I had this resolved.
The problem is this. I have deployed a program in the folder where the setup file is, I have a folder called CodeRed_1_0_0_10, inside that folder I have a file called CodeRed.exe.config.deploy. I want to be able to access this file.
The path is this:
C:\Deployed_4_10_06\CodeRed_1_0_0_10.
The setup.exe file is located in the Deployed_4_10_06 folder. I thought by using application.startuppath would point to this directory. However, after checking I found out that is points to this one below:
C:\Documents and Settings\yasin\Local Settings\Apps\2.0\YDBGO2AL.YA3\TOMO6HER.GJR\code..tion_53e3de40adb22891_0001.0000_adfb41cfb825f353
I thought by using this:
path = Application.StartupPath & "\CodeRed_1_0_0_11\" & "CodeRed.exe.config.deploy"
I would be able to update my file, but cannot not.
Is there a way to be able to point to the file where the setup.exe is located?
Many thanks in advance,
Steve
|
|
|
|
|
i'm trying to develop an addin for vb.net that allows the user to add a new (code created) class to the solution by right clicking on the solution in solution explorer and selecting a new context menu item from the list. this code will be dynamically generated based on some user input so cant be created by using a wizard.
i've been able to generate the class dynamically and add it to the solution etc. the one thing i havent been able to figure out is how to create the menu item so that it only appears when a "solution" type node is selected in the solution explorer window.
any help in this area would be appreciated
thanks in advance
swampy
|
|
|
|
|
I try to read data into array and display the data, however i only manage to get 1 in return. Below is my coding, may i have some suggestion and advice?
Option Strict On
Imports System.IO
Public Class Form1
Private Function Language(ByVal MLanguage As Integer, ByVal RequestDataID() As Integer, ByRef GetBackWord() As String) As String
Dim s As String = String.Empty
Dim Number As Integer = 0
Dim sFileName As String
If MLanguage = 1 Then
sFileName = "C:\testing.txt"
Try
Dim oFile As FileStream = New FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim oReader As StreamReader = New StreamReader(oFile)
Dim a As Integer = 0
Do Until (Number = RequestDataID(a))
If Number < RequestDataID(a) Then
s = oReader.ReadLine()
Language = s
'GetBackWord(6) = s
Number += 1
a += 1
Else
s = oReader.ReadLine()
End If
Loop
oReader.Close()
oFile.Close()
Catch
GetBackWord(0) = "a."
End Try
ElseIf MLanguage = 2 Then
sFileName = "C:\Maklumat.txt"
Try
Dim oFile As FileStream = New FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim oReader As StreamReader = New StreamReader(oFile)
Dim a As Integer = 0
Do Until (Number = RequestDataID(a))
If Number < RequestDataID(a) Then
s = oReader.ReadLine()
GetBackWord(a) = s
Number += 1
a += 1
Else
s = oReader.ReadLine()
End If
Loop
oReader.Close()
oFile.Close()
Catch
GetBackWord(0) = "a"
End Try
Else
sFileName = "C:\CMsg.txt"
Try
Dim oFile As FileStream = New FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim oReader As StreamReader = New StreamReader(oFile)
'Dim a As Integer = 0
Do Until (Number = RequestDataID(6))
If Number < RequestDataID(6) Then
s = oReader.ReadLine()
GetBackWord(6) = s
Number += 1
'a += 1
Else
s = oReader.ReadLine()
End If
Loop
oReader.Close()
oFile.Close()
Catch
GetBackWord(0) = "a"
End Try
End If
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer = 0
Dim sss() As String = {""}
Dim aaa() As Integer = {1, 2, 3, 4, 5, 6, 7}
'ReDim Preserve aaa(6)
Do Until a = 5
MessageBox.Show(Language(1, aaa, sss))
a += 1
Loop
End Sub
End Class
|
|
|
|
|
TeiUKei wrote: s = oReader.ReadLine()
Language = s
This seems redundant. Either way, your return value is being changed every time, not accumulated. Is that the intention ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
No, my intention is for example, everytime i receive a requestID(3), i will read 4 lines from the textfile and store in the array, GetBackWord(3) and display the lines i get. Any suggestion? I stuck there and be so appreciate for help.
|
|
|
|
|
I'm not really sure what you mean. The code looks messy - perhaps if you told us what's in the file, and what you expect the function to return ( and what you're getting instead ) ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well, this is the data in the file
No,Title
1,Error Message
Information
Question
a
b
c
d
e
f
Let say i receive RequestDataID = {1,2,3,4,5,6,7}, then for RequestDataID(0),line 1 will be read and stored in GetBackWord(0) which then send back to the function called and same with the other. However, i only manage to get c in return. What should i suppose to do?
|
|
|
|
|
I honestly can't work out how this code is supposed to work. Really, what you should do is read the entire file into an array, File.ReadAllLines (from memory ) does this. Then you can copy whatever lines you want.
Other suggestion - set a breakpoint and step through your code to try and work out where it's going wrong.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well, thanx for help anyway!!
|
|
|
|
|
I was hoping we might dig a little deeper. Does File.ReadAllLines ( or whatever it is ) help ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I checked my code and wondered if it was because RichTextbox only take the recent memory, that's why it only displayed one of it.
|
|
|
|