فارسی نویسی در ویژوال بیسیک بدون تغییر زبان کیبورد
برای اینکه بتوانیم در یک تکست باکس فارسی تایپ کنیم آن هم بدون تغییر زبان کیبورد با چند خط کد زیر می توانید این کار را انجام دهید
برای این کار ابتدا یک تکست باکس در فرم ایجاد کنید و سپس یک text box ایجاد کنید
نام این تکست باکس text1 بگذارید
در رویه keypress این تکست باکس کد زیر را بنویسید
با این کار بدون توجه به زبان کیبورد (به هر زبانی که باشد) فارسی نوشته می شود.
[FONT=courier new, courier, mono]Private Sub Text1_KeyPress(KeyAscii As Integer)[/FONT]
[FONT=courier new, courier, mono]On Error Resume Next[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 104 Then KeyAscii = -57[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 72 Then KeyAscii = -62[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 102 Then KeyAscii = -56[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 113 Then KeyAscii = -42[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 119 Then KeyAscii = -43[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 101 Then KeyAscii = -53[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 114 Then KeyAscii = -34[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 121 Then KeyAscii = -37[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 117 Then KeyAscii = -38[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 111 Then KeyAscii = -50[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 112 Then KeyAscii = -51[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 105 Then KeyAscii = -27[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 116 Then KeyAscii = -35[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 91 Then KeyAscii = -52[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 93 Then KeyAscii = -115[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 92 Then KeyAscii = -114[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 96 Then KeyAscii = -127[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 97 Then KeyAscii = -44[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 115 Then KeyAscii = -45[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 100 Then KeyAscii = -19[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 103 Then KeyAscii = -31[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 106 Then KeyAscii = -54[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 107 Then KeyAscii = -28[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 108 Then KeyAscii = -29[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 59 Then KeyAscii = -33[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 39 Then KeyAscii = -112[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 122 Then KeyAscii = -39[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 120 Then KeyAscii = -40[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 99 Then KeyAscii = -46[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 118 Then KeyAscii = -47[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 98 Then KeyAscii = -48[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 110 Then KeyAscii = -49[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 109 Then KeyAscii = -63[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 44 Then KeyAscii = -26[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 63 Then KeyAscii = 191[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 77 Then KeyAscii = -58[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 48 Then KeyAscii = 16[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 49 Then KeyAscii = 17[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 50 Then KeyAscii = 18[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 51 Then KeyAscii = 19[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 52 Then KeyAscii = 20[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 53 Then KeyAscii = 21[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 54 Then KeyAscii = 22[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 55 Then KeyAscii = 23[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 56 Then KeyAscii = 24[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 57 Then KeyAscii = 25[/FONT]
[FONT=courier new, courier, mono]If KeyAscii = 58 Then KeyAscii = 26[/FONT]
[FONT=courier new, courier, mono]End Sub[/FONT]
http://kojoor.blogfa.com/post-48.aspx