|
Answer to my own query:
First, to add a hyperlink to a cell in an existing table, make sure to omit the end-of-cell marker in defining the range for the Anchor.
The following works in a stable, predicitable manner:
<br />
Set R1 = ActiveDocument.Range(Start:=T.Cell(3,1).Range.Start, _<br />
End:=T.Cell(3,1).Range.End - 1)<br />
R1.Select<br />
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:=TheURL, _<br />
ScreenTip:="Link: " & TheURL, TextToDisplay:="Link" & BMi<br />
where R1 is a Range and TheURL is a string containing the URL to be made a hyperlink in a Word document.
The example is to add a hyperlink to row #3, col. #1 of an existing table. This is easily generalized to any i,j cell in a table.
Ed
|
|
|
|
|
Hi
Does anyone have a solution or maybe someone could point me in to the
right direction.
I would like to code a game config editor so I dont have to
edit configuration files manually.
The problem to solve is how my code makes my app find
a string like 'Playername' and then let me edit the playername.
It would be easy to code this if string Playername always would be
on the same row. But it will not always be on the same row.
Example
Playername = MyName
I want my app to find 'Playername' and then edit MyName.
BTW! My applicaiton lets me edit MyName in a textbox.
Should I use string Compare or Equals?
Please help me before my head goes Boom!
I have never coded a text editor before and I have'nt found
any help elsewhere about this kind of problem.
I am quite new to VB.Net.
|
|
|
|
|
You can use regular expressions, or there's a function called 'findfirstindex' or something that will search an entire string for a known substring.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi everybody, I got a short question regarding the WM_PRINT message in VB. It seems to me that the windows that Visual Basic 6 builds are not acting correclty when they receive this message. I got a big problem with this because I need to save in a memory DC the contents of a Window even IF IT IS NOT CURRENTLY DISPLAYED on the screen.
This is very frustrating, since even though I send a WM_PRINT message to the VB application, it does not print the client area. WM_PRINTCLIENT messages are also not working.
So the bottom line is: does ANYBODY know how I can override the OnPaint function of the window that the VB creates? I can subclass the window and get the WM_PRINT message, but I can't do anything upon receiving it, unless I can somehow determine the window to print itself in the specified DC. I can do this only by having access to the OnPaint function.
Thank you in advance for helping : D.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
I have a form which contains a richtextbox and a Toolbar with some buttons for change text : copy/delete/cut/paste/Bold/Italic/underLine/Color and ....
when I change my text in the richtextbox for example bold a word in my text, now If I use PrintForm method then it cannt print my Text in richtextbox while that word is bold.
how can print my richtextbox content exactly?
|
|
|
|
|
|
Hi I am working on CRM using ASP.net with VB.net... Actualy I want to generate controles say asp:textbox dynamicaly. But I am not able to this can any one help me in this regard.
Thanx in advance and Prayers after answer . Take care
Hope 4 the Best but Prepare 4 the Worst....!
|
|
|
|
|
Something like this
Dim tb as Textbox = new TextBox ( or however this goes, I'm a C# guy ).
Then you have a control, but it's not part of your page. You need to put a placeholder where you want to put your control, or create a repeater, or similar, which will give you a row object. Either the row or the placeholder has a controls property, you need to add your new control to the controls collection for it to appear in the page. Then you need to be careful to do this consitently and early in the page lifecycle or you'll find you won't get events or viewstate for the control.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a dataTable with an integer column called RAM_amt for amount of RAM on a machine. The DataTable is populated by a business logic object that I cannot change.
The RAM_amt is in bytes but I want the text box to display it in megabytes if the value let say is less than 1000 megabytes and display in gigabytes if the value is 1 gigabyte or more.
The logic is pretty easy but where would I put this code? Where is the msot efficient place to put this?
|
|
|
|
|
This is just an idea but perhaps you could programmatically add another column to the DataTable to use for the friendly display of the amount of RAM. After adding the new column perform a loop for each row in the DataTable and update the new column based on your "RAM_amt" column. Then bind that new column to your TextBox through code.
You would place this code somewhere after getting the DataTable. You can then remove any existing bindings for the TextBox and add the new one. Assuming you had a DataTable called dt it might look something like the code below.
dt.Columns.Add("RAM_text", Type.GetType("System.String"))<br />
Dim dr As DataRow<br />
For Each dr In dt.Rows<br />
dr("RAM_text") = GetFriendlySize(dr("RAM_amt"))<br />
Next<br />
TextBox1.DataBindings.Clear()<br />
TextBox1.DataBindings.Add(New Binding("Text", dt, "RAM_text"))
GetFriendlySize() would be a Function that calculates the display text from the byte value.
|
|
|
|
|
Does anyone think that using complex data binding to synchronize a listbox to textboxes is bad? I am binding a listbox to the same dataTable that 5 other textboxes are bound to so that the listbox works as a navigator.
For what I'm doing this seems like a quicker but also more efficient and error free solution.
Here are my other options
1. Manually through loops populate the listbox from the datatable. Then add a Listbox.selectedIndexChange handler to do a dataTable.rows.find for the selected item on the listbox. Then refresh the appropriate text boxes.
2. Bind only the listbox to the datatable. Then add a Listbox.selectedIndexChange handler to do a dataTable.rows.find for the selected item on the listbox. Then refresh the appropriate text boxes.
I've read some articles saying that complex databinding is bad programming practice.
Is there a performance gain by complex binding versus manual code?
|
|
|
|
|
hi all,
how do i know whether capslock is on?
i do not mean whether is is pressed, something like this this doesnt work
class form1 'keypreview is true
inherits form
'windows forms designer generated code etc
private CapsOn as boolean = false
protected overrides sub onkeydown(e as keyeventargs)
mybase.onkeydown(e)
if e.keycode = keys.capslock then capson = not capson
end sub
end class
beacuse when capslock is on before app starts stuff goes the wrong way around...
does anyone have a idea?
a api or something?
thanks, mouzik
|
|
|
|
|
.Net framework didn't encapsulate all the Windows APIs yet so you will have to call the following windows api:
Private Declare Function GetKeyState Lib "user32" (ByVal virtKey As Integer) As Short
Then call it.
For example:
if GetKeyState(Keys.CapsLock) = 1 then capson = true
|
|
|
|
|
thanks rudy!
although it didnt work at first, i got it working in the end:
Private Declare Function GetKeyState Lib "user32" (ByVal virtKey As Integer) As Integer
and to call it:
CapsOn = CBool((GetKeyState(Keys.CapsLock) And 65535) - 65408))
thanks again!
|
|
|
|
|
Hi i have converted a visual basic 6 project into vb.net.The project has a splash form then login form and then a main form. but what happens after i run the project the splash form appears and on its keypress event the login form is to get loaded but it closes the project . i donot know why. if i make login form the default startup object then also after its a right login it does not dispaly the main form and the project closes. pls help. me and if i use show dialog method then the formLoad events of the forms are not called and no defualt values are set which i try to set them on form load event. Pls tell me something
Thanks
|
|
|
|
|
Normally .net form apps are started by something like this:
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
If you have this and Form1 is your splash screen then the application will exit because it only runs as long as Form1 is open.
So inside the Run statement your application main form should be inserted. All other forms could be shown before this statement. Whats best in your situation depends on your special requirements.
|
|
|
|
|
Does anyone know any techiniques, tricks or anything cool about customizing command buttons and the way they look such as changing their shape, texture etc...???
|
|
|
|
|
Searching CodeProject will give you several hits.
I personally think this and this are fancy.
|
|
|
|
|
hi all,
how do i get the size of a file?
i have looked in the io.file class , but couldnt find a GetFileSize function or something
does anyone have an idea
thanks, mouzik
|
|
|
|
|
Try new System.IO.FileInfo(fileName).Length
|
|
|
|
|
|
Hi Guys..
i'm using the following code (in vb 6 ) to encode an ARABIC String into the UCS2 ,assighned to the StrData Byte Variable then pass the StrData To The Function to do then encoding..
the problem is when i wanted to apply this code in vb.net there were a problem in assighning a string value into the StrData Byte Variable,which tells that can't convert string variable into 1-dimention array of byte.!!
and when i changed the function to accept an array of characters insted of a byte var. it always return the same encoding for any arabic string..!!
do any 1 know how to solve this problem? or know any good simple way to encode arabic string to UCS2 ..?
here is the function in vb6...
Public Function ArabicHex(b() As Byte) As String<br />
Dim s As String, h As String<br />
Dim i As Integer<br />
i = 0<br />
s = ""<br />
While i <= UBound(b)<br />
h = Right("00" & Hex(b(i)), 2)<br />
i = i + 1<br />
h = Right("00" & Hex(b(i)), 2) & h<br />
If h = "000D" Then h = ""<br />
s = s & h<br />
i = i + 1<br />
Wend<br />
ArabicHex = s<br />
End Function
any quick response will be helpfull and thankfull..
confused:
|
|
|
|
|
Hi There!!
When I run the program that I have created for a Pocket PC device it does not show my application on the Project PC Emulator, is it possible to view your created program on there without having to upload it to a real Pocket PC!!, If so please can you give me advice on how to do this.
Thanks
|
|
|
|
|
You need to deploy your app to a Emulator you selected
ASP.NET C# VB VC & SQL Windows APP ...
|
|
|
|
|
Hello there
I have built a mulit-lingual application. The default language is English. When User Change the language I fetch the record from resource file and re-set the labels with the new language. but when I assign the new language, The font which was Bold becomes normal. and from now onwards if you go back to English language it will remain normal.
Any Idea's.... ?
|
|
|
|