Code im Editor

  • VB.NET

Es gibt 11 Antworten in diesem Thema. Der letzte Beitrag () ist von vb-checker.

    Code im Editor

    Hallo zusammen,

    ich bin neu hier und bin mal gespannt, ob mir hier jemand helfen kann. :)

    Ich mache z.Zt. ein Fernstudium und soll Code für VB im Editor schreiben. Ist soweit auch kein Problem.

    Allerdings habe ich bisher Windows Vista genutzt und jetzt auf Windows 7 ungestellt. Grade wollte ich meinen letzten Code im Editor aufrufen. Und was sehe ich? Nichts wird mehr richtig dargestellt. Nicht mal mein Text ist übrig... Was kann ich tun? Woran liegt das?

    Wenn ich das Programm in der Konsole starte, funktioniert allerdings alles einwandfrei...

    Ich könnte jetzt alles neu schreiben, aber das möchte ich vermeiden. Gibt es ne Möglichkeit?

    So sieht es jetzt aus...

    Spoiler anzeigen
    MZ ÿÿ ¸ @ € º ´ Í!¸LÍ!This program cannot be run in DOS mode.

    $ PE L ëºO à ¾/ @ @ € @… l/ O @ è ` H .text Ä `.rsrc è @ @ @.reloc ` @ B / H d"
    (
    *(
    *¦s
    € s
    € s
    € s
    € * 0 ~ o


    + * 0 ~ o

    + * 0 ~ o

    + * 0 ~ o


    + * 0 (
    (

    + * 0 (

    + * 0 Ð (

    + * 0 (

    + * 0 Π-
    ( +
    ++
    + *0
    þ  *(
    *0 ~
    Π-
    ( +€
    ~

    + *(
    ** 0 o e
    j ·œjÖ dj1ðj jdj[
    + Ø·œjÖ 1ðjÖ 2j1Új ·‘1r pŒ (
    jÖ dj1Þ(
    * BSJB v4.0.30319 l H #~ ´ ô #Strings ¨
    #US ¸
    #GUID È
    @ #Blob W¢ ú%3 ! * â
    ¦ |
    Ú ¼ ê ã
    B| Àã WA pA … Ç´
    ß
    S6 ˆh ¦ã Êã
    ã þ 1ã Gh bã gã mã …ã ˜h ¸h ) 7 : 7 E 7
    O
    ]
    x
    1 1 .- 1 P: 1 uG  Q€8™ P ¶ X ¶ ` ñ Œ ø ¨ ( Ä G5 à eB ü F«c ! F´h 4! ƒ Ål P! FÍq h! Öx Œ! ô€ ¨! ¶ °! ‹ Ü! ¶ ä! ñ è! < ² ë ë ¶ 1 ¶ ¡ A ¶ ° ¶ I ¶ $ ¶ , ¶ 4 ¶ < ¶ $ ‹ , ‹ 4 ‹ < ‹ Q ¶ Y ¶ a ¶ i —O «c ´h ) ¸\ Íq y Ôl ¶  ¶ |D  ‰ ¶ ÷‘ ¶ ™ ¶ ± u± { ¹ ¶ Á ¶ É ¶ œ ) ƒ . . @ + Ï @ § C § C ¶ I ƒ c § c ¶ i ƒ .€ + Ï ƒ { Ï ƒ ¶ ƒ s Ï ‰ ƒ ; + Ï ¡ ã Ï ¡ Û Ï £ § £ à „À + Ï Ã § Ã Ó üà + Ï ã s Ï + Ï § + Ï § @ § @+ Ï ` § `+ Ï €+ Ï + Ï À § À+ Ï à+ Ï + Ï § @û Ï ð õ ú ÿ TXchwwò Ú O “T BY Ÿ^ ,” u u ˆ Ô Û â é æ€ Ö


    ã é é é- r- í <Module> mscorlib Microsoft.VisualBasic MyApplication My MyComputer MyProject MyWebServices ThreadSafeObjectProvider`1 abc Microsoft.VisualBasic.ApplicationServices ApplicationBase .ctor Microsoft.VisualBasic.Devices Computer System Object .cctor get_Computer m_ComputerObjectProvider get_Application m_AppObjectProvider User get_User m_UserObjectProvider get_WebServices m_MyWebServicesObjectProvider Application WebServices Equals o GetHashCode Type GetType ToString Create__Instance__ T instance Dispose__Instance__ get_GetInstance m_ThreadStaticValue GetInstance MAX Main System.ComponentModel EditorBrowsableAttribute EditorBrowsableState System.CodeDom.Compiler GeneratedCodeAttribute System.Diagnostics DebuggerHiddenAttribute Microsoft.VisualBasic.CompilerServices StandardModuleAttribute HideModuleNameAttribute System.ComponentModel.Design HelpKeywordAttribute System.Runtime.CompilerServices RuntimeHelpers GetObjectValue RuntimeTypeHandle GetTypeFromHandle Activator CreateInstance MyGroupCollectionAttribute System.Runtime.InteropServices ComVisibleAttribute ThreadStaticAttribute CompilerGeneratedAttribute Byte Int64 Console Write WriteLine STAThreadAttribute CompilationRelaxationsAttribute RuntimeCompatibilityAttribute 200_sieb_01 200_sieb_01.exe
    { 0 , 5 } ™–">›4L§"K?¹ÿ ·z\V4à‰°?_Õ
    : 0 ( d
    MyTemplate10.0.0.0 My.Application My.Computer My.User My.WebServices 9
    a 4System.Web.Services.Protocols.SoapHttpClientProtocolCreate__Instance__Dispose__Instance__



    TWrapNonExceptionThrows ”/ ®/ / _CorExeMain mscoree.dll ÿ% @ € 8 € P € h € €  @ T øB ê T4 V S _ V E R S I O N _ I N F O ½ïþ ? D V a r F i l e I n f o $ T r a n s l a t i o n °´ S t r i n g F i l e I n f o  0 0 0 0 0 4 b 0 , F i l e D e s c r i p t i o n 0 F i l e V e r s i o n 0 . 0 . 0 . 0 @ I n t e r n a l N a m e 2 0 0 _ s i e b _ 0 1 . e x e ( L e g a l C o p y r i g h t H O r i g i n a l F i l e n a m e 2 0 0 _ s i e b _ 0 1 . e x e 4 P r o d u c t V e r s i o n 0 . 0 . 0 . 0 8 A s s e m b l y V e r s i o n 0 . 0 . 0 . 0 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
    <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
    </requestedPrivileges>
    </security>
    </trustInfo>
    </assembly>




    Danke schon mal für die Hilfe! :)


    Edit by Dodo:
    -> Code in Expander gepackt

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Dodo“ ()

    Sunrisegl75 schrieb:

    soll Code für VB im Editor schreiben.

    verstehe ich nicht.

    Ich öffne immer mit Visualstudio ein .sln - file. Eine Solution besteht aus mehreren Dateien, und die Dateien, die im Editor bearbeitet werden können, werden auch im VS-Editor angezeigt.

    Was du postest , ist entweder eine beschädigte Datei, oder wurde mittm falschen Editor geöffnet.
    Es gibt bei dem Studium nun mal Vorgaben, womit gearbeitet werden muss.

    Ich habe die Datei mit exakt dem gleichen Editor geöffnet, wie sonst auch. Nämlich mit dem unter Windows. Nur eben vorher auf Vista und jetzt auf Win7.

    Ich verstehe es auch nicht. Wie gesagt, in der Konsole läuft das Programm... ?( Naja, bevor ich noch mehr Zeit verliere, mache ich es eben neu.

    Aber trotzdem danke!



    Wenn ich die entsprechende VB Datei öffne, ist alles korrekt. So sollte es sein:

    '200_sieb_01.vb

    'Primzahlen

    'ermittelt Primzahlen bis 100

    Imports
    System.Console

    Module
    abc
    const MAX asInteger = 100
    Sub Main()
    'Variablen i, j, aByte(100)

    dim aByte(MAX) asbyte
    Dim i, j aslong

    'für alle i von 2 bis 100for i = 2 to MAX
    aByte(i) = 1
    next

    'für i von 2 bis 100/2for i = 2 to MAX\2for j = 2 to 100\i
    aByte(i*j) = 0
    Nextnext i

    'für i von 1 bis 100for i = 1 to MAX

    If aByte(i) > 0 thenwrite("{0,5} ",i)
    Endif
    Next
    writeline EndSub
    EndModule
    Das gleiche Problem hatte ich auch, Erklärung:

    1. So etwas passiert meist nach einem Crash
    2. Es handelt sich um eine kaputte .VB Datei (Wenn du tatsächlich wie beschrieben, eben jene öffnen wolltest und nicht die EXE mit Notepad)
    3. Du wirst entweder ein Backup nutzen, die Datei wiederherstellen oder von vorne anfangen müssen.
    Der gepostete Code beginnt mit MZ, gefolgt von unüblichen Zeichen (was auf Hexdezimalwerte, die als ASCII interpretiert werden, schließen lässt) und enthält relativ weit am Anfang den Text "This program cannot be run in DOS Mode" - du versuchst mit 99%iger Wahrscheinlichkeit, eine ausführbare Datei (.exe) zu öffnen. Im neuen Betriebssystem schon eingestellt, dass Dateiendungen angezeigt werden?

    Edit: Ich habe gerade testweise die PE von irgendeinem Programm von mir im Editor geöffnet. Outcome:

    Quellcode

    1. MZ ÿÿ ¸ @ € º ´ Í!¸LÍ!This program cannot be run in DOS mode.
    2. $ PE L ÍÞHN à î+ @ @ € @… ˜+ S @ È ` à* H .text ô `.rsrc È @ @ @.reloc ` @ B Ð+ H à! 0 ` r p(
    3. (
    4. s
    5. o
    6. (
    7. o
    8. o
    9. s
    10. 8› š r! po
    11. o
    12. šr! pr! po
    13. o
    14. š(
    15. r% po
    16. þ
    17. - o
    18. Yo
    19. Þ & Þ o
    20. - o
    21. (
    22. X Žiþ
    23. :Tÿÿÿr) p(
    24. (
    25. s
    26. o
    27. +(!
    28. o"
    29. (#
    30. -ßÞþ o$
    31. Ü o%
    32. rI p(
    33. (&
    34. &* J _© %7 ('
    35. *BSJB v4.0.30319 l ¬ #~ À #Strings Ø \ #US 4 #GUID D ¼ #Blob G ú%3 '
    36. J C s a Š a § a Æ a ß a ø a a .a fG zG ˆa ¡a ؾ ñ? G' g' …C ª  ·  ÌC äC ý N c [ €  ”C ³C ( P ‘ Q
    37. Ø! †V \ V V ! V ) V 1 V 9 V A V I V Q V Y V a V i V q V y V ‰ V $ ‘ V ™ ) ™ —. ¡ V © Â2 ± Ø. ¹ ë6 ¹ ÷; V ¹ H ¹ &O ¹ /T ¹ :X A] Jc É V fi tx Ù  ‹} á   Ù ¨ ™ ® V .   . · . · . # ½ . +   . 3 Ì . ; · . K · . S í . c . k $. s Š. { “. ƒ œ… B r € ( : <Module> taxonomyGenerator.exe Program taxonomyGenerator mscorlib System Object Main .ctor args System.Reflection AssemblyTitleAttribute AssemblyDescriptionAttribute AssemblyConfigurationAttribute AssemblyCompanyAttribute AssemblyProductAttribute AssemblyCopyrightAttribute AssemblyTrademarkAttribute AssemblyCultureAttribute System.Runtime.InteropServices ComVisibleAttribute GuidAttribute AssemblyVersionAttribute AssemblyFileVersionAttribute System.Runtime.Versioning TargetFrameworkAttribute System.Diagnostics DebuggableAttribute DebuggingModes System.Runtime.CompilerServices CompilationRelaxationsAttribute RuntimeCompatibilityAttribute Console WriteLine ReadLine System.IO StreamReader TextReader ReadToEnd Environment get_NewLine String ToCharArray Split System.Collections.Generic List`1 Concat EndsWith get_Length Remove Contains Add StreamWriter Enumerator GetEnumerator get_Current TextWriter MoveNext IDisposable Dispose Close Read Exception D a t e i e i n l e s e n : > S p e i c h e r n a l s : F e r t i g ! ÷Ž
    38. [C«Br¼i¢àÅ ·z\V4à‰ A a i i Qeai taxonomyGenerator Microsoft Copyright © Microsoft 2011 ) $6fdb840a-eb23-4804-9373-93243ed37ace 1.0.0.0 e ).NETFramework,Version=v4.0,Profile=Client TFrameworkDisplayName.NET Framework 4 Client Profile TWrapNonExceptionThrows ÍÞHN ™ ü* ü RSDS¹°eÑ—hH  ~¨R
    39. 7
    40. C:\Users\youshouldgiveafckonthis\documents\visual studio 2010\Projects\taxonomyGenerator\taxonomyGenerator\obj\x86\Debug\taxonomyGenerator.pdb À+ Þ+ Ð+ _CorExeMain mscoree.dll ÿ% @ € 8 € P € h € €   @ 8 ØC ê 84 V S _ V E R S I O N _ I N F O ½ïþ ? D V a r F i l e I n f o $ T r a n s l a t i o n °˜ S t r i n g F i l e I n f o t 0 0 0 0 0 4 b 0 4
    41. C o m p a n y N a m e M i c r o s o f t L F i l e D e s c r i p t i o n t a x o n o m y G e n e r a t o r 0 F i l e V e r s i o n 1 . 0 . 0 . 0 L I n t e r n a l N a m e t a x o n o m y G e n e r a t o r . e x e \ L e g a l C o p y r i g h t C o p y r i g h t © M i c r o s o f t 2 0 1 1 T O r i g i n a l F i l e n a m e t a x o n o m y G e n e r a t o r . e x e D P r o d u c t N a m e t a x o n o m y G e n e r a t o r 4 P r o d u c t V e r s i o n 1 . 0 . 0 . 0 8 A s s e m b l y V e r s i o n 1 . 0 . 0 . 0 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    42. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    43. <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
    44. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    45. <security>
    46. <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    47. <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
    48. </requestedPrivileges>
    49. </security>
    50. </trustInfo>
    51. </assembly>
    52. ð;
    Oh Mann, das ist mir jetzt furchtbar peinlich...

    Ich sollte das mit dem Studium vllt. noch mal überdenken... :S Ich habe den ganzen Tag nach dem Fehler gesucht und habe euch mit diesem Mist belästigt. Ich habe den Fehler gefunden... Ich habe versucht, die falsche Datei zu öffnen... *rotwerd* Eine .exe ist natürlich schwer zu lesen für den Editor... Die .vb ist sauber...

    Sorry nochmal für die Umstände!!! Und danke an alle, die versucht haben zu helfen!!!
    kein Grund für peinlich.
    Als Anfänger gibts unendlich viel, was du einfach nicht wissen kannst - dafür isses Forum ja da.
    Peinlich ist eine Frage erst, wenn mans eiglich selber wissen können sollte.
    Und auch wer sich super-gut auskennt, wird gelegentlich auch scheinbar total dumme Fragen stellen, denn vor TomatenAufDenAugen gibts einfach keinen Schutz (naja, ausser eben den Austausch übers Problem).

    Der nützlichste Hinweis scheint mir in post#7

    creac schrieb:

    Im neuen Betriebssystem schon eingestellt, dass Dateiendungen angezeigt werden?
    - dass man dieses Windoof-DeppenFeature "bekannte Dateiendungen verbergen" deaktiviert, sodaß man im Explorer sehen kann, was für eine Datei man öffnet.
    Kann es sein, dass Du eine EXE im NOTEPAD geöffnet hast?
    Klar, dass Du da nur Murks siehst.
    Du musst, wenn überhaupt, *.vb-Dateien im Editor öffnen!
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!