|
You can use the following sample codes also
Dim new_font As Font
new_font = New Font(TextBox1.Font.Size, 30)
TextBox1.Font = new_font
|
|
|
|
|
Load the document into Word, search for your field tags and replace each with a Word field.
I have no idea what the code to add the field would be since I don't do Office Interop in my work.
But that's how you would do it.
|
|
|
|
|
Thanks a lot
Thanks
Terry
|
|
|
|
|
Dave Kreskowiak wrote: search for your field tags and replace each with a Word field
I've seen it done before a few years ago, only if I could remember how it was done :->
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi all!
I have a common text box on a form, now how do I make that textbox to be an instance of a subclass?
It has to inherit the subclass that i've wrote but i just dont know how to do that.
need help, Thanks.
Regards,
jensen
|
|
|
|
|
I don't understand what your'e doing. You can't make a TextBox be a subclass of your class. You can make your own class inherit from TextBxo though.
Public Class MyTextBox
Inherits TextBox
|
|
|
|
|
Well lets say i have a form with a panel in placed. Now, i would like to have that panel in that form to inherit a class.
Below is a part of something that i've managed to do. It seems okay, or at least it seemed.
<br />
Public Class theForm<br />
<br />
Private WithEvents new_panel As myPanel<br />
<br />
Private Sub theForm_Load() Handles MyBase.Load<br />
<br />
new_panel = New myPanel(panel1.Handle)<br />
<br />
End Sub<br />
<br />
End Class<br />
<br />
<br />
Public Class myPanel<br />
<br />
Public Sub New(ByVal pWindowHandle As IntPtr)<br />
MyBase.AssignHandle(pWindowHandle)<br />
End Sub<br />
<br />
End Class<br />
Can i inherit in such a way? Or is there a better way of doing this?
|
|
|
|
|
jensenx wrote: Public Class myPanel
Public Sub New(ByVal pWindowHandle As IntPtr)
MyBase.AssignHandle(pWindowHandle)
End Sub
End Class
You have no base class in the above. What do you expect the base class to be?
jensenx wrote: Can i inherit in such a way? Or is there a better way of doing this?
The code you show does not use inheritance, it uses composition.
By not,
Public Class MyPanel InheritsFrom Panel
' Do what you need to in the panel
End Class
In your form class you create a control of MyPanel rather than Panel .
|
|
|
|
|
jensenx wrote: new_panel = New myPanel(panel1.Handle)
That's not inheriting a class. That's just having your class use the window handle of another panel. That does NOT make your class inherit from another.
jensenx wrote: MyBase.AssignHandle(pWindowHandle)
Since your class doesn't inherit from anything (explicitly anyway). MyBase will actually just refer to the instance of your class, myNameSpace.myPanel.
|
|
|
|
|
Hi
I have one VPN Software installed on my machine. Now Either I am connected with VPN or not , No one from domain can browse my machine, I am hosting Development Server so while running the software who tries to connect SQL Server on my machine results into Error. If any one pings me then it times out. I can access any one on the network .
Is there any solution for this type of problem. As I am afraid if my software will be installed at any machine where VPN Exists then it will not work properly.
Regards
|
|
|
|
|
This is probably because the VPN software adds a level of security akin to a firewall that's blocking everything inbound to your machine.
And what does this have to do with VB.NET?
|
|
|
|
|
Yes I understand the security issue which is implemented with VPN.
Dave Kreskowiak wrote: And what does this have to do with VB.NET?
When we install any VB.net application with Client Server Architecture and it has to contact any machine where VPN is installed could result into an error. I thought may be there is any solution for this so that application could run smoothly. This could be any authentication code which could be added
Regards
|
|
|
|
|
hi all
i have a webbrowser control, and i m trying to store all information about the user.(the ids, passwords etc) when user first time use my application, second time when user opens my application all work has been done automatically ( all the things like open site, enter the id and password, go to the inbox, download attachment automatically.
for confidential things like passwords i can ask the user to enter, but i still trying to explore how can i send this information back to the site.
i tried to get the form which contain the textboxes that contain the id and password and the go button, but i m unable to get the values of those and enter my values in those textboxes.
i have found some articles on the same that use the code (but i think that's from vb6 )
With mybrowser.document<br />
.All.Item("login").Value = "myloginid"<br />
.All.Item("passwd").Value = "mypassword"<br />
.Forms(0).submit<br />
End With
i can find the form that contain the id and password fields with
If Me.WebBrowser1.Document.Forms(1).Name = "loginform" Then
does some one has any idea then please let me know.
thanks in advance
help everyone
|
|
|
|
|
Take a look at the DigiOz Post To Web Form DLL. It does exactly that (includes source code and a demo project). You can get it here:
http://www.digioz.com/dlls.php[^]
Scroll about half way down the page and you will see it.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
I have a small VB.Net 2005 project that started out with a form that a user would select different options and things would calculate based on the options. The options could be saved and retrieved to xml files and everything worked great. Then I got the bright idea to have multiple screens (all the same options). I built a custom tabpage and added my controls to them and got them to work as expected. On the tab page I set some properties and call a routing on my main form (using my.forms.main.MyRoutine) and that routine reads the properties just fine. Now the issue is if I run something from the form itself I can't figure out how to access anything on the tab pages. I want to be able to read things like text boxes and such. When I run a button on the tab page I can send the info back but since the tab pages are dynamically created and added to thhe tab control I can't seem to access them. How do I do this?
I.e. in simple terms I add a custom tabpage with 3 text boxes to a tab control on my main form. How can I access those text boxes from a command on the main form? How can I access text boxes on other tabs?
-Allan
|
|
|
|
|
Salaam Alaikom
you can solve your problem by uisng RaiseEvent, this is an example to show you the solution
suppose you have a Form called frmMain, and you did class that add to integer numbers, you need to know if the fuction Add in the Class AddTwoNumbers called or not, so u need to add event for this case
Public Class AddTwoNumbers
Private m_firstValue As Integer
Private m_secondValue As Integer
Public Event OnAdd(message As String)
Public Sub New()
m_firstValue=0
m_secondValue=0
End Sub
Public Property FirstValue()As Integer
Get
Return m_firstValue
End Get
Set(value As Integer)
m_firstValue=value
End Set
End Property
Public Property SecondValue()As Integer
Get
Return m_secondValue
End Get
Set(value As Integer)
m_secondValue=value
End Set
End Property
Public Function Add()As Integer
RaiseEvent OnAdd("The Fuction Add is running now")
Return m_firstValue + m_secondValue
End Function
EndClass
now in your Form "frmMain" do this add 2 text boxes ["txtFirstValue","txtSecondValue"] boxes and a button "btnAdd"
Public Class frmMain
Private WithEvents m_addClass As New AddTwoNumbers()
' here you can handle the Event OnAdd in the class AddTwoNumbers,
'that means when you call the method m_addClass.Add() the following
'event will be fired
Private Sub addClass_OnAdd(value As String) Handles m_addClass.OnAdd
MessageBox.Show(value)
End Sub
Private Sub btnAdd_Click(sender As Object,e As EventArgs)Handles btnAdd.Click
' add the values of the input textboxes to the class
If IsNumeric(txtFirstValue) Then m_addClass.FirstValue=CInt(txtFirstValue.Text.Trim())
If IsNumeric(txtSecondValue) Then m_addClass.SecondValue=CInt(txtSecondValue.Text.Trim())
'call the function Add, you will see 2 message boxes, one fired
' by the event that is found in the class and you handled it in
'this form, and the other by the following message
MessageBox.Show(m_addClass.Add().ToString())
End Sub
End Class
finally, have you a nice programming time
regards
Hadi Hassan
Lebanon,Beirut
hadi.84@hotmail.com
-- modified at 5:09 Saturday 8th September, 2007
|
|
|
|
|
Thanks for the reply but that confused me more. Heres what I have. I have a tab control on my main form. I dynamically add tab pages to this tab control. There are a couple text boxes on each dynamically created tab page and when I click a button on the main form I want to get the values of them back. But I can't seem to access the tab page or the text boxes because once its added I don't know how to reference it. Do I use something like the above and if so how do I keep track of multiple tab pages? Say I have 5 dynamically added tab pages, how can I access the text boxes on tab page number 3?
-Allan
|
|
|
|
|
I gave up on the whole raise events stuff. For now I made a bunch of "holder" boxes on the main form and in the "Enter" event of the tab pages I assign the stuff on the tab page to the stuff on the main form holder boxes (like My.Forms.Main.CheckBox1 = Me.CheckBox1). Then the buttons on the main form just use the info in the holder boxes, which is always the currently displayed tab. This is working surprisingly good and when I do need to calculate something from all the tabs I just run through and select each one, grab the holder boxes for each, then go back to the one it was on. Happens so fast you can't tell what its doing. I'm sure this isn't the "proper" way but its working.....thanks for trying.
-Allan
|
|
|
|
|
Hello all,
I need a little help on how to do something. I am working with VB.Net 2005 and I need to read through each row on a Data Grid and grab the values of each field and save it to a formatted String so I can pass that String over to a Crystal Report as a parameter. I can handle passing the String to CR but building it from the Data Grid is where I am getting stuck.
I need for it look like this….
Row1Value1(tab) Row1Value2(tab) Row1Value3
Row2Value1(tab) Row2Value2(tab) Row2Value3
I really appreciate any help/suggestions that anyone can provide.
|
|
|
|
|
I can see this getting ugly very fast...
All you have to do is iterate over the collection of rows in the DataGridView. And in each Row, iterate over the collection of cells:
For Each r As DataGridViewRow in DataGridView1.Rows
For Each c As DataGridViewCell in r
Dim value As String = c.Value.ToString()
Next
Next
You'll, of course, have to modify this for your own situation. It won't concatenate a string together. It just shows you have to get at the values.
|
|
|
|
|
Thanks Dave, I will see take this example and see what I can come up with over the weekend. As always, you are a great help!! Have a great weekend!
|
|
|
|
|
Hi,
To set a String with tabs, try the following code. Its a modified version of what Dave provided.
<br />
Dim mainStr as String = ""<br />
Dim rowStr as String = ""<br />
<br />
For Each r As DataGridViewRow in DataGridView1.Rows<br />
rowStr = ""<br />
For Each c As DataGridViewCell in r<br />
If (c.ColumnIndex > 0) Then<br />
rowStr += ControlChars.Tab<br />
End If<br />
rowStr += c.Value.ToString()<br />
Next<br />
mainStr += rowStr + ControlChars.CrLf<br />
Next<br />
This code will produce the results as u wanted i.e.
CCG3 wrote: Row1Value1(tab) Row1Value2(tab) Row1Value3
Row2Value1(tab) Row2Value2(tab) Row2Value3
Hope this helps to your expectations.
Thanks
Terry
|
|
|
|
|
Dim MsgDirPath As String = mats.GetSetting("UnpackLocation")
The above code will get a string (a path to a file like F:\folder1\aaaa.exe). Now if I need just the filename(i.e. "aaaa"), how do I get it? I can't use trim as the length might vary everytime I change the path. Probably there are more options for using Trim() that I don't know.
Any kind of help or suggestions are appreciated.
|
|
|
|
|
Checkout the Path class in the System.Io namespace. It exposes methods to manipulate path strings.
|
|
|
|
|
One option would be to split on "\", take the last string in that array and split it on "." and take the first string in that array.
|
|
|
|