|
buzz5958 wrote: Dim txtPhone As String
Dim phone(11) As String
txtPhone = CStr("xxx - xxx - xxxx")
phone(11) = CStr("xxx - xxx - xxxx")
phone(3) = CStr("xxx")
This code is useless. Get rid of it. why do you need an array of strings ?
buzz5958 wrote: btnPush.ToString.Substring(0, 3)
This code gets a string from a button ( presumably 'Button' ) and returns a substring ( presumably 'But' ).
buzz5958 wrote: txtArea.Text = ("xxx")
The brackets in this code are superfluous, and this code sets the area code to be three x's.
It seems to me that you're wildly guessing, which is both not going to work, and not going to teach you anything if it manages to. You've got the substring method, so what do you want to get the substring of ? I assume you have a control which contains the phone number ( txtPhone is a good name for this control ). It has a Text property. This gives you the entered string. If you're allowed to assume a very specific input format, then the Substring method, on the text property of this control, will return the area code.
In future, I recommend you read through your textbooks and try to understand the process, instead of making wild guesses.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: txtPhone = CStr("xxx - xxx - xxxx")
phone(11) = CStr("xxx - xxx - xxxx")
phone(3) = CStr("xxx")
This code is useless
Yep. Why do arrays of strings?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Christian Graus wrote: use a regular expression
Sounds like the OP is pretty new to this stuff and that would be too much for him.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Yes, I mentioned it only for completeness.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: mentioned it only for completeness
I'll admit that I would have done the same
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Well, at that point, I was keen to give a full answer, he may well have said 'Oh, regex, yeah, I googled that and found Expresso and it helped me build what I needed'. that doesn't seem so possible, now....
When I was first learning, I'd have made a note that regex was a better solution, gone with what got me through the day, bought a book on regex and learned it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, I am sorry but I am new to all of this and the string thing just doesnt make since to me at all. I just thought that I might get some help to understand. I am taking an introduction to programming using Visual Basic 2005 and I am only in my 3rd week of the class. I did read the chapter, I just don't understand. Maybe I am trying to over think the process.
Thanks for all of your help,
Alexia
|
|
|
|
|
buzz5958 wrote: Maybe I am trying to over think the process.
Hey, it happens to all of us (well, those of us who will admit it). If you know that the area code is in a standard format such as (xxx) xxx-xxxx, you can always use the SubString method to pick out the area code. Once you have mastered working with strings, look at regular expressions as Christian said. They are really powerful and advanced
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Well, first of all how are phone numbers formatted where you are?
For example:
(020) 1234 5678
(0141) 123 4567
(01383) 123 456
Next what methods on the string class could you use to extract that area code? (Hint: you will be looking for something to find the position of certain characters and you will be looking for something to get a partial string from the original)
|
|
|
|
|
Hello all!
*VS2005 Datagrid
Here's what ive noticed on datagrid's vertical scrollbar behaviour,
1. The vertical scroll will not scroll between rows based on position of the scroll but instead based on rows. Moving the vertical scroll up/down will not matter much unless you have moved the scroll bar just enough so that the next/previous row can completely be seen.
Thus to programmatically change the vertical scrollbar's position, you can set as such;
<br />
dataGrid.FirstDisplayedScrollingRowIndex = x<br />
Now, i'm wondering why wouldnt the scrollbar be used to view something just like how any other scroll does where its based on scrollbar's position? And yes the weird thing is, the datagrid's horizontal scroll bar works normally.
Is there any way that I could change the datagrid's vertical scrollbar to display its content just as how the horizontal scroll would?
Thanks in advance!
Regards,
Jensen
|
|
|
|
|
Private Sub Print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print.Click
PrintDialog1.Document = PrintDocument1
PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings
PrintDialog1.AllowSomePages = True
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings
PrintDocument1.Print() 'this is the line where its showing the
error:uable to handle event.win32 exception
End If
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
End Sub
what should i do.i m getting printer settings page but when i click print i am getting that error.plz mail me at niteshaga@gmail.com
|
|
|
|
|
You should not put your email address in a post, you'll open yourself up to spammers. If someone can help you, they'll tell you right here.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello all developers,
am developing small project using vb.net with sql server, that project was completed successfully also am created the exe it was working nice with oter system also, but now i want to create a webapllication out put for the same project? that is like to open it in IE in any other ssytems in the network. Is it possible? if Possible then How to do it? Please explain..............
Note: am create a vb.net Project, code begin is VB, Connection is ODBC using SQL Client
|
|
|
|
|
rrrriiizz wrote: but now i want to create a webapllication out put for the same project?
Create a new Web Forms project. The code would be exectued on your IIS server, not on the client. You're really just creating a website.
At least I'm assuming you're talking about writing a web-based application and not a web-based installer to install your Windows Forms application on the client machine.
-- modified at 9:24 Saturday 8th September, 2007
|
|
|
|
|
how to change the size of font of textbox in vb.net using code
|
|
|
|
|
Salaam Alaikom
you can change the font size by doing this code
let us say that your textbox is called "txtValue"
then u do this id you want the size be 20 for example
txtValue.Font=New Font(txtValue.Font.Name,20)
regards
Hadi Hassan
Lebanon,Beirut
hadi.84@hotmail.com
|
|
|
|
|
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.
|
|
|
|