I have started making a master-server program for a small project involving the reconstruction of a game on a new engine. The master server program currently looks like this:
is a large textbox 'console' with 'found 4 install processor' which outputs raw event message sent to client / game player using master-server. It can copy the Inputer and Administrator ( the only person who has access to this interface of a master-server program) ) only from the text box; They can not remove / can not add anything.
The issue is that because it is considered a 'console', it should automatically scroll up to the last line of the multiline text box.
There are a lot of questions on the stack overflow that cover it (for example), but when I put the code inside the console_TextChanged
subroutine, I have not been able to do it (text box does not scroll) I have tried to:
Private sub console * shortened (sender as object in the form of sender, and EventArgs) Console handles. BackChanged console.AppendText (text) console.Select (console.TextLength, 0) console.ScrollToCaret () end sub
This does not work, but it causes a bug in the program Where each line is added quite often to the title of the program:
[Net 11: 32: 22.243] System started Surfer network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis War 1.5Server Network | Crysis Wars 1.5
Some C # solutions have also worked in Visual Basic for me. In the past, and so I have tried, but I am not able to work on them.
Is it really the right way to autoscroll a multilined text box, and if so, why is not it working for me?
Complete (relevant) code:
Private sub form 1_load (as the sender object, and event MyBase Handle Handle as ARG) Text = GetNetTime () + "System started." WriteToConsole ("Working Area:" + CSRR (My Computer, Screen Working Area (.) Width) + "*" + CSR (My Computer Screen. Working Area (Height)) Attendance ("Found" + CSR Environment (Processor) + "Install Processor (S)") as Integer = 0 as DIM I (I & lt; Environment; ProcessorCount) WrittenToconol ("Processor" + CSRR (I) + ":" + My Computer. Registry Local. Mackin Opensky (" GetValue ("Processor Name") WriteToConsole ("Family:" + My.Computer.Registry.LocalMachine.OpenSubKey ("Hardware \ Description \ System" Central Processor \ "+ CSRR (i). GetValue (" Identifier ") WriteToConsole (" Manufacturer: "+ My.Computer.Registry.LocalMachine.OpenSubKey (" Hardware \ Description \ System \ Central Processor \ "+ CSRR (i)) .GetValue ("Vendor Identifier")) I + = 1 End When WriteToConsole ("Starting Networking Services") End Sub-Sub Sub-U The console handles the console (as the sender object, and even TArgs) console. Convert Text Console AppendText (text) console. Select (console text extension, 0) console. ScrollToCaret () End Sub Function GetNetTime () Return "[Net" + CST (DateTime.UtcNow.Hour) + ":" + CSRR (Datetime.UtCNO.mitt) + ":" + + CSRR (Datetime, UTC Now. + ". +". + CSTR (Datetime, UTC Nine milliseconds) + "Function Function WriteToConsole (Volt Input as String) Console.EpendText (EnvironmentalNew and GateNetTime (Input +)) Return -1 and Function
If you are using AppendText
Can not completely get rid of
Textbox
, because text tags
method because AppendText
already does it for you.
For any reason (a bug may be?) Is conveyed to the screen, paragraph text
does not scroll to the end. Now I have no good explanation, we have Need to check the source of the net frame.
In an optional form, just type your code to MyBase.Shown
Move to event, no Load
event works as expected, difference shown
event will be raised when presented on the screen for the first time on the screen Because the form is removed before being presented before opposing load
.
Comments
Post a Comment