|
The instructions on how to create a VB6 console app by hand would take a few pages. If you are not using, or have never heard of, vbAdvance, I HIGHLY recommend you check his product out: http://www.vbadvance.com/[^]. I've been using it for a few years and I don't know how I lived without it.
|
|
|
|
|
how to print the run time form without going to microsoft world using printscreen key in vb.net as well as vb
himanshu
|
|
|
|
|
using printdocument if you need some sample code email me !
I am Entry level person
|
|
|
|
|
I am working on a simple text editor in vb .net. My problem is one of preserving the the rtf format in the rich textbox when using the property:
RT.RightToLeft = Windows.Forms.RightToLeft.Yes
or
RT.RightToLeft = Windows.Forms.RightToLeft.No
changing the property in either direction will make text in rich texbox turn to simple text and no formatting.
I can use another hidden rich textbox to copy and paste formatted text but I am looking for a more elegant solution.
I would appreciate any help.
Thanks in advance
baankhi
|
|
|
|
|
i wanna kill. what a stupid work , working with raw data. At the end i learnt, how to print raw data print via LPT1 Port . But when i send data , Printer gives error. I'm sure my printer is connected from LPT1 port.
Could Anyone try this code,
Imports System.IO <br />
Imports System.Runtime.InteropServices <br />
<br />
Public Class Form1 <br />
Inherits System.Windows.Forms.Form <br />
Public Const GENERIC_WRITE = &H40000000 <br />
Public Const OPEN_EXISTING = 3 <br />
Public Const FILE_SHARE_WRITE = &H2 <br />
<br />
Dim LPTPORT As String <br />
Dim hPort As Integer <br />
<br />
Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" ( _ <br />
ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, _ <br />
ByVal dwShareMode As Integer, _ <br />
ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, _ <br />
ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, _ <br />
ByVal hTemplateFile As Integer) As Integer <br />
<br />
Public Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer <br />
Dim retval As Integer <br />
<br />
Public Structure SECURITY_ATTRIBUTES <br />
Private nLength As Integer <br />
Private lpSecurityDescriptor As Integer <br />
Private bInheritHandle As Integer <br />
End Structure <br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click <br />
Dim Texxxt As String <br />
Dim SA As SECURITY_ATTRIBUTES <br />
Dim outFile As FileStream, hPortP As IntPtr <br />
<br />
LPTPORT = "LPT1" <br />
Texxxt = Me.RichTextBox1.Text <br />
hPort = CreateFile(LPTPORT, GENERIC_WRITE, FILE_SHARE_WRITE, SA, OPEN_EXISTING, 0, 0) <br />
<br />
hPortP = New IntPtr(hPort) 'convert Integer to IntPtr <br />
outFile = New FileStream(hPortP, FileAccess.Write, False) 'Create FileStream using Handle <br />
<br />
Dim fileWriter As New StreamWriter(outFile) <br />
'MessageBox.Show(RichTextBox1.Text ) <br />
' fileWriter.AutoFlush = False <br />
fileWriter.WriteLine(RichTextBox1.Text) <br />
fileWriter.WriteLine("Hello World2") <br />
fileWriter.WriteLine("Hello World1") <br />
fileWriter.WriteLine("Hello World2") <br />
fileWriter.Write(Chr(12)) '12 <br />
fileWriter.Flush() <br />
fileWriter.Close() <br />
outFile.Close() <br />
<br />
retval = CloseHandle(hPort) <br />
End Sub <br />
End Class
|
|
|
|
|
Your printer is probably expecting data in its printer control language (i.e. something like PCL, PostScript etc..) but you are sending it plain text.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
|
I would use the PrintDocument class and use it. That way the printer driver handles all the conversion to printer control language.
However if you have a good reason to have to write to the printer directly you need to know what language(s) that printer expects - this is information that you would need to look in the printer manufacturer's online support pages for.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
but i cant use Print Document object with dot matrix printers . am i wrong ?
|
|
|
|
|
What ever gave you that idea? Of course you can.
It's not the type of printer that dictates how your going to do this, but rather what you want to print. If you want total control over the printer, then you'll have to use this RAW method. Anything else, and you can use the PrintDocument class.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I tried but whenever i send document to print ; i got error, then i wrote this state to forum , you (Dave) said to me USE RAW PRINT.
I will re-EXPLAIN my problem.
I m working on Accountancy project. We use printers like (OKI-MICROLINE 320,500,321 etc using SLIDING PAPERS) The Reports can be printable from these printers.
1. Could i do this with printdocument object and printpage event?
2. What do i have to do as additional work for SlidingPapers.?
(For example must i use Courier New Font, what will do if i use Arial and Arial Narrow?)
|
|
|
|
|
hey all,
i have a dataset with three related tables in it. Table_1 -> 1-n Table_2 -> 1-n -> Table_3
I build a treeview with Table_1 and show the related rows of Table_2 in a Datagrid (grid_1). By selecting a row in the grid i show the details of that row and all related rows of Table_3 in another grid (grid_2). If i use perfmon to watch all exceptions of my application i get 5 Exceptions each time i select another node in the treeview (each node represents a datarow of Table_1). If I don't assign the second grid with a datasource (in my case a dataview of Table_1) i get no exceptions.
The difference between grid_1 and grid_2 is the assignment of the datasource. The datasource of grid_1 will be assigned in the AfterNodeSelected event of the treeview after positioning the currencymanager tho the right position. the datasource of grid_2 will be assigned at initialization time.
Private Sub trvProducts_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles trvProducts.AfterSelect<br />
If Not Me.trvProducts.SelectedNode Is Nothing Then<br />
<br />
Dim i As Integer = Me.NavigationView.Find(CType(Me.trvProducts.SelectedNode.Tag, Product.Model.dsProduct.tblProductGroupRow).ID)<br />
<br />
Me.Grid_1.SuspendLayout()<br />
Me.Grid_1.DataMember = ""<br />
Me.Grid_1.DataSource = Nothing<br />
<br />
cmGroup.Position = i<br />
<br />
Me.Grid_1.DataMember = "tblProductGrouptblProduct"<br />
Me.Grid_1.DataSource = NavigationView<br />
Me.Grid_1.Refresh()<br />
Me.Grid_1.ResumeLayout(True)<br />
<br />
End If<br />
End Sub<br />
<br />
public Sub New()<br />
<br />
[...]<br />
<br />
NavigationView.Table = Me.Dataset.Table_1<br />
<br />
Me.Grid_2.DataMember = "tblProductGrouptblProduct.tblProducttblProductPrice"<br />
Me.Grid_2.DataSource = NavigationView<br />
<br />
End Sub
Please Help !!
cheers, Bernd
|
|
|
|
|
I've never had this problem before on any other computer or on my previous installation of VS.Net. (I have VS.Net 2003 Pro) What I think is referred to as intellisense (the little context-sensitive drop down box that offers an alphabetical list of suggestions when you're typing code) seems to always be defaulting to something in the "t" range as follows:
When I type txtSomething (a textbox on my form) and then . the box comes up with textlength highlighted as the suggestion.
This happens when I refer to any object (combo box/label/the form itself) in code and want to change a property of that object. It's not really a problem in most cases, but when I want to change or get the text in a text box (like in the example above), I can't simply type txtSomething.text = ... or else the intellisense thinks I want to select .textlength and kindly inserts it for me when I press the space bar after typing text which then produces txtSomething.textlength = ... . the only two ways I can stop it from doing this are by pressing the up arrow key twice after typing text but before pressing the space bar(so as to select text instead of textlength , or just going back to correct it each time.
Generally, I like this feature of VB/VS.net, but it's not working the way I think it's supposed to. Anyone know what's happening? how to shut it off? reset something? thanks in advance
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
-- modified at 1:58 Tuesday 18th October, 2005
|
|
|
|
|
hey
i have had this problem alot, too, but it was with daSomething.Fill and it kept selecting FillSchema. the best solution i found was to type the same commands over and over, but using something completely different. once it starts selecting the new command for you, then it should be fixed for the other one.
another problem is, (though it not be relavent in this case) is if the desired word comes after the selected word, you will have to type out almost the entire word to get intellisense to select it.
your best bet is to type the "t", scroll to your selection and hit ctrl+space. i'm not sure of any way to "reset" intellisense, though i think there should be.
hope this helps,
stephen
|
|
|
|
|
Thank you greatly. I did happen to notice it suggesting other things for other objects since that post and managed to follow your advice before reading it. Thank you nonetheless for your answer.
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
|
|
|
|
|
hi all,
iam new to vbscript...
i created one application in VC++.
i would like to give brief explanation abt that...
my application is abt recording process...
when u enter any URL , it opens that url...like yahoo or google..whatever we wish...then ,if we press record button...it starts recording.
onwards what u have done(click,mousemovement,and etc) in that site , it records everything...after that we can save that in one file...
again if we want to playback that,we should open that save file...and we can play it...
For this process i want to write vbscript in a log file with using microsoft script control...how can I? can you please guide me..
iam greatful to u...
|
|
|
|
|
how to search and replace text in a rich text box ???
I am Entry level person
|
|
|
|
|
If you mean doing it through code then one way is:
Dim textToSearch as string = "was"
Dim textToReplace as string = "gonnabe"
Dim textToSearchIn as string = yourRichTextBox.Text
Dim position as integer
position = textToSearchIn.IndexOf(textToSearch)
while position<>-1 ' If found
textToSearchIn = string.concat (textToSearchIn.Substring(0,position)), _
textToReplace, textToSearchIn.substring(position+textToSearch.length-1))
position = textToSearchIn.IndexOf(textToSearch)
end while
yourRichTextBox.Text = textToSearchIn
There may be other, and better, ways of accomplishing it but this should be also easy to understand the approach.
|
|
|
|
|
I did a query in Access and used that table as the datasource. Is there a way to do a SQL statement with multiple joins to an Access table in .Net? It always chokes when I try to include multiple tables. Thanks
Jerry
|
|
|
|
|
i donot really understand, coz as i know you can databind to a table in the dataset and you just specify the dataset name and datatable name!
I am Entry level person
|
|
|
|
|
I'm trying to insert text and a graphic (jpg) into a word document. The user would select rows from their database and insert them into a word document.
My thought was to have my VB .net application execute MS Word. Upon opening a document the user selected, search for the text string [[INSERT]] (this could occur multiple times). Upon finding the text string, I would replace [[INSERT]] with text and graphic within the active document. The user would them save it. If there were other instances of the text string, the VB .net app would replace each successive [[INSERT]] with the next selected row from the database.
I'm not familar with macros in MS Word. I had look through MSDN and saw some VBA snipets, but not find and replace for Word.
Thanks for any help you could provide.
|
|
|
|
|
i'm writing a small app to change the windows mouse in VS'05, to change a key i do this:
Imports Microsoft.Win32
.
..
Dim key as RegistryKey = Registry.CurrentUser.OpenSubKey("Control Panel\\Cursors",True)
key.SetValue("Arrow","%SYSTEMROOT%\NewCursor.cur",RegistryValueKind.ExpandString)
i would like to do this same thing in VS'03, but it does not facilitate the last parameter where i use the RegistryValueKind class (or enum, whatever it is).
does anyone know the vb03 equivalent to the line:
key.SetValue("Arrow","%SYSTEMROOT%\NewCursor.cur",RegistryValueKind.ExpandString) ?
|
|
|
|
|
From the MSDN Gospel:
Note: When setting a value, the way in which the value being passed is stored in the registry is interpreted. There is no way to control whether the information being passed is stored as an sz, or an expanded_sz string, and therefore, all string values are interpreted as standard sz values.
If the .SetValue method call will not set the value properly, then you'll have to P/Invoke the Registry API calls yourself to do it correctly. Check out http://www.pinvoke.net[^] for more information.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
well it would seem that the the site you gave me only lists API functions that retrieve the datatype, not change it. am i wrong?
|
|
|
|
|
Is there any tutorial regarding skinning an application? because I found an OCX file that allows you to skin your application, it's called VB Skinner. I wonder if I can create my own skin. Thanx
|
|
|
|