|
I have a string:
...point_units="meters">...
and I want to extract the word 'meters' (no quotes). How do I remove the quotes?
This is what I **want** to do:
strUnits = Replace(strUnits, "point_units="","")
strUnits = Replace(strUnits, ">"", "")
The extra quote is killing my syntax. Is there a work around?
This is a VBScript that I'm working on but it seems like it should be similar to VB.
|
|
|
|
|
Brad Fackrell wrote: How do I remove the quotes?
Using a regex as the title of your posts suggests? Otherwise, the string.Replace function would indeed do the trick too.
Why not capture the characters between the quotes? Sounds like that's what you're after.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: Why not capture the characters between the quotes?
That is exactly what I want to do. In the end I want my string to be meters. I can do this all day long until my string contains a quote. I'm trying to figure out how to deal with quotes when I need to use quotes to group my syntax.
Your right, my choice of words may be confusing. I do the best I can.
|
|
|
|
|
To include a " within a string "" is to be used. Accordingly, if we put "" in the string, the meters can be extracted as shown below
<script type="text/vbscript">
strUnits = "point_units=""meters"">"
strUnits = Replace(strUnits, "point_units=""","")
strUnits = Replace(strUnits, """>", "")
document.write(strUnits)
</script>
|
|
|
|
|
VJ Reddy wrote: "point_units=""","")
Ah...the old extra quote trick. Many thanks!
|
|
|
|
|
You're welcome and thank you for the response.
|
|
|
|
|
I would use RegEx, but this is a dirty way to do it:
Dim strUnitsResolved As String = String.Empty
Dim strUnits As String = "point_units=""'meters'"">"""
strUnits = Replace(strUnits, "point_units=""'", "")
strUnitsResolved = Replace(strUnits, "'"">""", String.Empty)
MsgBox(strUnitsResolved)
|
|
|
|
|
I have one ActiveX DLL which contain a form and class module.
I need to stop the form execution(end the form without displaying it) if some conditions are not satisfying.
but Form1.Hide ,Unload Me and End are not working and throwing Run time Errors
only Exit sub is working but it does not stop form showing.
but my requirement is I have to close the application as soon as the conditions proved wrong.
Please help me .
|
|
|
|
|
Run time errors? You mean exceptions?
Can you paste the exception information here? (Log the exception using Exception.ToString in a try-catch block)
Bastard Programmer from Hell
|
|
|
|
|
It is giving AUTOMATION ERRORS AND CAN NOT CREATE OBJECT.
It is class code
Public Sub mdlShow(accesstype As String,cmd As String)
Dim frm As FormMain
Set frm = New FormMain
frm.Show vbModal
End Sub
in form
public sub form_load()
return=checking()
if return=0 then
'HERE I NEED TO STOP THE PROGRAM EXECUTION WITHOUT SHOWING FORM BUT IT IS NOT POSSIBLE WITH EXIT SUB AND FORM1.HIDE UNLOAD ME END IS NOT WOKING
End Sub
PLEASE HELP SIR
|
|
|
|
|
How about doing the check before you actually create a form?
Public Sub mdlShow(accesstype As String,cmd As String)
return=checking()
if return<>0 then
Dim frm As New FormMain
frm.Show vbModal
end if
End Sub
in form
Also note that using all-caps gives the impression of SHOUTING.
Bastard Programmer from Hell
|
|
|
|
|
Hi,
I have searched all over the internet trying to find a remote desktop app. I found one that uses an activeX control, but the screen in all sideways and wierd. any help would be greatly appreciated
|
|
|
|
|
Help with what? And what does this have to do with VB.NET??
|
|
|
|
|
I would like to make a remote desktop connection app in vb.net. Sorry for not being clear.
|
|
|
|
|
|
Thanks. What would the server, domain, username, and password be?
Thanks again.
|
|
|
|
|
"Server" would be the address of the computer you want to connect to.
"Domain" would be the domain of the user (this would be the computer you are connecting to, if you want to use a local user).
"Username" would be the username you wish to connect as.
"Password" would be the password of the user that you wish to connect as.
Hope this helps. Without knowing the exact details of your situation, I can't give you exact values, but this should be enough to get you going. If you have ever used Windows' built-in RDC client, these should be familiar.
|
|
|
|
|
Thanks Very Much. I will try it out as soon as I get time.
|
|
|
|
|
Could you mark my answer as accepted so I can get credit for it? Thanks!
|
|
|
|
|
I just tried it out and put the name of the computer for server, WORKGROUP for the domain, since we are on a workgroup, me for username, and me for password. When I ran it, it didn't do anything. any suggestions greatly appreciated. also, how do I "accept" an answer? im kind of new here. Thanks
I was able to get a remote desktop app that you can control the users computer, but the screen is all sideways and messed up, is there a way to fix that? It is using the AXrdpViewer. also, is there a way to make it to where I can disable being able to control the computer? I have tried putting a form over it, but that didn't work
Here is the code for the client:
Imports RDPCOMAPILib
Imports System.Net.Sockets
Public Class Form1
Dim x As New RDPSession
Dim clientSocket As New System.Net.Sockets.TcpClient()
Dim serverStream As NetworkStream
Dim readData As String
Dim infiniteCounter As Integer
Dim a As String
Dim b As String
Dim drag As Boolean
Dim mousex As Integer
Dim mousey As Integer
Private Sub Incoming(ByVal Guest As Object)
Dim MyGuest As IRDPSRAPIAttendee = Guest
MyGuest.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_INTERACTIVE
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim strHostName As String
strHostName = System.Net.Dns.GetHostName()
a = System.Net.Dns.GetHostByName(strHostName).AddressList(0).ToString()
b =
readData = "Conected to Chat Server ..."
clientSocket.Connect("IP ADDRESS", 8888)
serverStream = clientSocket.GetStream()
Dim outStream As Byte() = _
System.Text.Encoding.ASCII.GetBytes(b + "$")
serverStream.Write(outStream, 0, outStream.Length)
serverStream.Flush()
AddHandler x.OnAttendeeConnected, AddressOf Incoming
x.Open()
Dim Invitation As IRDPSRAPIInvitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10)
outStream = System.Text.Encoding.ASCII.GetBytes("V" + "$")
serverStream.Write(outStream, 0, outStream.Length)
outStream = System.Text.Encoding.ASCII.GetBytes("V" + Invitation.ConnectionString + "$")
serverStream.Write(outStream, 0, outStream.Length)
End Sub
End Class
Here's is the code for the Viewer:
Imports System.Net.Sockets
Public Class Form1
Dim clientSocket As New System.Net.Sockets.TcpClient()
Dim serverStream As NetworkStream
Dim readData As String
Dim infiniteCounter As Integer
Dim a As String
Dim b As String
Dim drag As Boolean
Dim mousex As Integer
Dim mousey As Integer
Dim Invitation
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.TopMost = True
TextBox1.Text = Invitation
If TextBox1.Text.StartsWith("USERNAME says : V") Then
TextBox1.Text = TextBox1.Text.Remove(0, 12)
ElseIf TextBox1.Text.StartsWith("USERNAME says : V") Then
TextBox1.Text = TextBox1.Text.Remove(0, 13)
End If
AxRDPViewer1.Connect(TextBox1.Text, "User1", "")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxRDPViewer1.Disconnect()
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Form2.Visible = True
Form2.TopMost = True
Dim strHostName As String
strHostName = System.Net.Dns.GetHostName()
a = System.Net.Dns.GetHostByName(strHostName).AddressList(0).ToString()
b =
readData = "Conected to Chat Server ..."
msg()
clientSocket.Connect("IP ADDRESS", 8888)
serverStream = clientSocket.GetStream()
Dim outStream As Byte() = _
System.Text.Encoding.ASCII.GetBytes(b + "$")
serverStream.Write(outStream, 0, outStream.Length)
serverStream.Flush()
Dim ctThread As Threading.Thread = New Threading.Thread(AddressOf getMessage)
ctThread.Start()
End Sub
Private Sub msg()
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(AddressOf msg))
Else
invitation = readData
End If
End Sub
Private Sub getMessage()
For infiniteCounter = 1 To 2
infiniteCounter = 1
serverStream = clientSocket.GetStream()
Dim buffSize As Integer
Dim inStream(10024) As Byte
buffSize = clientSocket.ReceiveBufferSize
serverStream.Read(inStream, 0, buffSize)
Dim returndata As String = _
System.Text.Encoding.ASCII.GetString(inStream)
readData = "" + returndata
msg()
Next
End Sub
End Class
On the client side, when it is opened, it send a chat message with the "Invitation" to the chat server. The remote viewer takes that message and puts it as the invitation to connect. .
Any help appreciated. IF there is no way to change this, then I will live with it...
modified 20-Apr-12 12:31pm.
|
|
|
|
|
Hello !
i'm working on a project vb.net/sql server 2008r2.
i have a document model on .docx or pdf document.This document is formatted , has borders , logo , some grafic elements ...etc , but i want to put some information from my database in some specific position of the document.
( i try first to import this on a crystal report but the document resolution after the import is very low)
is possible from vb.net to get data from database and to populate the .doc or pdf document ?
Thank you.
|
|
|
|
|
Sounds like instead of creating a new word document, you want to insert data into your already formatted document.
The easiest method I can think of would be an automated mail merge routine drawing data from a data source such as an excel spreadsheet which could contain the insertion field data you require for the word document.
Getting the data from a database to an excel spreadsheet is also easy using vb.net. Just create your array holding what data you need, then to export to excel call a routine such as "WriteSpreadsheetFromArray(MyArrayName)"
You will find the source code for the above function (WriteSpreadsheetFromArray) at http://www.vbforums.com/showthread.php?t=455162
Hope this helps you.
|
|
|
|
|
thank you !
But i want to put data on word document not excel.
Can you explain more clearly how can i do ?
Thank you!
|
|
|
|
|
Hi Alejx,
In your initial post you suggest your word document is already formatted with borders, logo and graphics and you wanted to place certain data in specific positions on the word document.
The easiest way to do this is using a mail merge routine. Almost every business office environment uses this method to product multiple word documents. The excel spreadsheet being also a Microsoft product is the ideal platform to hold the data you wish placed on the word document.
To understand this more fully, I suggest you google microsoft mail merge routines, but basically you get your already formatted word document and creat insertion points where you wish the data to go, then run the rountine which will cycle though the data on the excel spreadsheet and create your identical word documents with the data positioned where you wanted.
Is this clearer to you?
|
|
|
|
|
You can use the Interop.Word [^] namespace to create word documents, and something like iTextSharp[^] for PDF.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|