|
DataGridView is a Windows Forms control only. It doesn't support showing child tables the way you want without HEAVY modifications to the DGV. You'd be better off using a 3rd party grid control like DevExpress' XtraGrid.
|
|
|
|
|
No other Solution?
I don't want the third party grid!
But thanks anyway
A.
|
|
|
|
|
The other solution would take you about 3 months to write. Like I said, the DGV doesn't natively support showing child tables. I went for a 3rd party solution, and after downloading and installing the controls, had my requirement done in about 3 minutes.
|
|
|
|
|
You can use the "old" DataGrid.
|
|
|
|
|
|
Some help on good practice would be appreciated.
I have the following function and similar functions, but often get a squigly line
somewhere in the functions which tells me the function does not return a value on all paths.
Public Function ConvertToXmlDocument() As XmlDocument
'Alter the return type to suit - either stream or file or other
Dim FileLineString As String
Dim LineNumberInteger As Int32
Dim XmlSequenceCount As Int32
'Create xml envelope
Dim XmlOutputDocument As New Xml.XmlDocument
Try
'Intialise Xml Document
If InitialiseXmlDocument(XmlOutputDocument, "Flat file" Then
'Loop array / reading each line of file content
For Each FileLineString In Me.FileContentString
'Line count
LineNumberInteger += 1
'Retrieve xml node.......
'Unformat retrieved node against file line....
Next
Return XmlOutputDocument
End If
Catch ex As Exception
Return Nothing
End Try
End Function
Should i use multiple returns (ie another return statement after the end try) or is their a much better way in general, not just specific to this function?
Many Thanks
|
|
|
|
|
Dim XmlOutputDocument As New Xml.XmlDocument
try
'do your code
catch ex As Exception
'error message
end try
Return XmlOutputDocument
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
The 'function does not return a value on all paths' is happening because you have code like...
Try
If x=y Then
...
Return x
End If
Catch
Return Nothing
End Try
But if you note if the 'If' clause is not met then nothing will be returned, so you should implement something similar to
Try
If x=y Then
...
Return x
Else
Return y
End If
Catch
Return Nothing
End Try
|
|
|
|
|
Many thanks , think i'll try applying the return at the end of the function.
|
|
|
|
|
I believe in the concept that a function should have but a single Return statement. Create a variable in the beginning of the function and set it's default return value. The rest of the function code should work on validating input parameters and changing that default value or throwing an exception if something goes wrong. By the time the execution gets to the bottom of the function, the return statement has the value that needs to go back to the caller.
|
|
|
|
|
I have system developed in VB.Net,I need it to send e mails to a special domain for example to instructors in university
any one can help?
There is always something to learn
|
|
|
|
|
the following code should work
Imports System.web.Mail
Imports System.Web
Private Sub sendmail()
Dim attch As ArrayList = Nothing
Dim myMessage As MailMessage
Try
myMessage = New MailMessage()
With myMessage
.To = ' INSERT adress to who to send
.From = 'INSERT From wich adress to send
.Subject = 'INSERT subject
Dim text As String = System.Text.RegularExpressions.Regex.Replace(txtbody.Text, "\n", "<br>")
.Body = text
.BodyFormat = MailFormat.Html
'.Cc = CC
'.Bcc = BCC
If Not attch Is Nothing Then
For i = 0 To attch.Count - 1
If FileExists(attch(i)) Then
Dim s As New System.Web.Mail.MailAttachment(attch(i))
.Attachments.Add(s)
End If
Next
End If
End With
SmtpMail.SmtpServer = 'INSERT smtp server here
SmtpMail.Send(myMessage)
Catch myexp As Exception
' Throw myexp
End Try
end sub
hope this helps
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
Damn! I have some grass that needs cutting and my truck needs an oil change too! Ummm, what else can you do for me, ... OH! How about refinishing the floor in a bedroom and painting. I mean, since you're doing his homework for him and all...
|
|
|
|
|
Dave Kreskowiak wrote: I have some grass that needs cutting
shure when I'm in the neihberhood
Dave Kreskowiak wrote: my truck needs an oil change
I can try but will not be held responsible for any accidents like accidently setting you'r truck on fire
Dave Kreskowiak wrote: refinishing the floor in a bedroom and painting
shure but I pick the colors
Dave Kreskowiak wrote: I mean, since you're doing his homework for him and all...
I dought that his homework is only sending a mail (if it is I wish I went to his school). But you'r right I should have pikked up on that. Anyway I had the code written in one of my projects so I took me all but 3min to do the post but still 3min to much.
I'll go beat myself up now for not spotting this (normaly I'm better at spotting homework questions, guess he got lucky and got me on a weak moment)
-- modified at 3:34 Thursday 25th October, 2007
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
TDDragon wrote: dought that his homework is only sending a mail (if it is I wish I went to his school). But you'r right I should have pikked up on that. Anyway I had the code written in one of my projects so I took me all but 3min to do the post but still 3min to much.
I'll go beat myself up now for not spotting this (normaly I'm better at spotting homework questions, guess he got lucky and got me on a weak moment)
It happens. I've caught myself doing the same thing, and I usually beat myself up like this too.
TDDragon wrote: The only way we learn is by making mistakes.
That's what going to University is for!
|
|
|
|
|
Dave Kreskowiak wrote:
TDDragon wrote:
The only way we learn is by making mistakes.
That's what going to University is for!
making mistakes or learning
true going to university is good but I'v learned more in the 9 months now that I'v been working than my 4 years in university
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
thanks a lot
your help is helpfull,
but I have a question more about this topic: can I let the message content be the result of some calculation with in my system(programm)?
to contain a chart for example?
Best Wishes
Knowledge student
There is always something to learn
|
|
|
|
|
Hi,
I am a very beginner in ASP & VB.NET development
I learnt how to create classes in web site using VB.Net language but I do not know how to use them or even give them the ability to change in the main form(defualt)
Thanks
There is always something to learn
|
|
|
|
|
Seriously, pick up a beginners book on VB.NET and learn the language. Forget ASP.NET for now. It's just adding a layer of comlexity that you don't need right now. Learn the basics of VB.NET, THEN you can move on to adding ASP.NET to your skill set.
|
|
|
|
|
hi all
I have a textbox where i search using a Button. So every time i enter values in a textbox , i have to use a mouse to click a Search button. am looking for a way, where a user can enter text to be searched in a textbox, and after that a "Enter" key to run a Search,i want a way to move focus from textbox to button with Enter key. i tried to google this but i did not know how to to put it, so i decided to post it.
Please send me vb.net Examples.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
There are two ways, set the form's AcceptButton propert to the search button or in keypress for the textbox:
if e.keychar = chrw(keys.return) or e.keychar = chrw(keys.return) then<br />
me.searchbutton.performclick()<br />
end if
code may be abit wrong but you get the idea.
|
|
|
|
|
Thanks man , Thats nice, can you do the same in the Situation of a Combobox and a Button? , like the textbox used it this way
If Asc(e.KeyChar) = Keys.Enter Then
btnSearch.PerformClick()
End If
The Above code will be in keypress event. in combobox how will achieve this?
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Yeh just throw it into the keypress for the combobox and assign whatever button you want. I think key press has e.handled = true, if not , maybe use key down to avoid undesired affects, say:
On key down:
If e.keycode = Keys.Enter Then
btnSearch.PerformClick()
e.handled = true
End If
Try that.
|
|
|
|
|
You can put the textbox and button in a panel and then set the panels defaultbutton property to the id of the button. Pressing enter in the textbox will then essentially post back as if the button had been clicked
|
|
|
|
|
ah...indeed, that one slipped my mind.
|
|
|
|