|
This is entirely wrong. You don't put this in the Form's Paint event and you don't create Graphics object for other controls. This code should have been put under the Paint event for the TreeView control. Create your own TreeView control, inheriting from the standard TreeView, and put your painting code in that control's Paint event.
|
|
|
|
|
run-time error 2147467259(80004005)
|
|
|
|
|
|
Good. It means something is wrong. Please don't give too much information, or someone will be able to help you.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Overly descriptive Aye.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I am getting session out problem in my application where i am using following code in web.config file
<trace> enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginurl="/TTMS/TTMSLogin.aspx" protection="All" timeout="60">
<credentials passwordformat="Clear">
<sessionstate mode="InProc" statenetworktimeout="10000" sqlcommandtimeout="500" regenerateexpiredsessionid="true " stateconnectionstring="tcpip=127.0.0.1:42424" sqlconnectionstring="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="10000">
<httpruntime maxrequestlength="80192">
and on cs side of loginpage code is:
FormsAuthentication.RedirectFromLoginPage(txtUser.Text,true);//on click of submit form
but this code does not resolve my problem
|
|
|
|
|
First, this question belongs in the ASP.NET forum. Next, when you post code snippets containing tags, "<tag></tag>", you have to check the little box that says "Ignore HTML tags in this message" before you click "Post Message".
And lastly, this is the VB.NET Forum, not C#.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007, 2008
modified on Monday, January 5, 2009 8:15 AM
|
|
|
|
|
Hi Dave
Thanx for your suggesions,actually i am using this forum first time so did these kind of mistakes,i have send this code in c# but i m getting session out problem for vb.net applications also,do you have any solution
|
|
|
|
|
Ask in the ASP.NET Forum. What you're asking has nothing to do with VB.NET or C#.
|
|
|
|
|
Hi,
I am beginner in VB programming. I would like to write a program (using Visual Basic 2008 Express edition) to retrieve emails from a POP3 email account (such as yahoo mail).
Can anyone advise me how to go about it? It will be very helpful to me if you can give me sample code.
Thank you very much for your help.
|
|
|
|
|
Could you pls send code which you r using for sending mail
|
|
|
|
|
You can use the following code to send a mail , it use an smtp server,please enter proper email id as marked in the comments , i have tested it from a gmail account
Dim smtpClient As New Net.Mail.SmtpClient()
Dim mail As New Net.Mail.MailMessage()
'create the message to be sent
mail.To.Add("test@test.com") ' Enter the Email of the person you want to send the mail to
mail.From = New Net.Mail.MailAddress("username@gmail.com", "Your Display Name") ' Enter Your email address
mail.Subject = "Test Message"
mail.Body = "This is a test message"
' Prepare the client to send the above message
smtpClient.Host = "smtp.gmail.com"
smtpClient.EnableSsl = True
smtpClient.Port = 587
smtpClient.Credentials = New Net.NetworkCredential("username@gmail.com", "password") 'Enter username and password of the account , you want to use to send mail
smtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
smtpClient.Send(mail)
<pre>
Hope it is helpful
-Regards
Bharat Jain
Phisys Software Solutions Pvt. Ltd.
bharat.jain.nagpur@gmail.com
|
|
|
|
|
helen00 wrote: I am beginner in VB programming.
One of the first things all beginneers should learn is how to research a problem. Try google, there are loads of examples to be had.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi All,
Has anybody been successful with drag and drop or pasting to a webbrowser control in VS 9.0 VB.net? All examples I have come across refer to ‘ExecWB’ which unfortunatly is not a member of System.windows.forms.webbrowser in VB.Net 9.0. There is a property ‘AllowWebBrowserDrop’ but how I trap the event when DragDrop, DragEnter, ect… events for the control don’t exist? I am not sure where to trap the drop event. I would gladly give you my firstborn for any relevant information on the subject. Thanks
Stu
|
|
|
|
|
Well... Nobody has answered my question so let me explain how I overcame the webbrowsers controls drag and drop issues. I created a transparent control (TCtl) that I placed over the webbrowser control I added handlers for dragenter and dragdrop for TCtl. I parsed the dropped html info to retrieve all of the images url's & then downloaded the images to a localdrive & replaced the href in the html to point to the local images. I then saved the html to a file. I could then load the file into the webbrowser control. Slicker than a rats ass if I may say so. Some of the code is shown below.
For saving the images....
Source = web url, Dest = local drive....
Private Sub GetWebFile(ByVal strSource As String, ByVal strDest As String)
Dim WebConnection As New WebClient()
Try
If File.Exists(strDest) Then File.Delete(strDest)
WebConnection.DownloadFile(strSource, strDest)
Catch ex As Exception
MsgBox("Error retrieving web file", ex.Message)
End Try
End Sub
For the drag and drop from a webpage (not complete)....
Private Sub TCtlDragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)
e.Effect = DragDropEffects.Copy
If e.Data.GetDataPresent(DataFormats.Html) Then
TCtlDropFormat = "HTML"
ElseIf e.Data.GetDataPresent(DataFormats.FileDrop) Then
TCtlDropFormat = "File"
ElseIf e.Data.GetDataPresent(DataFormats.Bitmap) Then
TCtlDropFormat = "Bitmap"
ElseIf e.Data.GetDataPresent(DataFormats.Text) Then
TCtlDropFormat = "Text"
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub TCtlDragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)
Select Case TCtlDropFormat
Case "HTML"
Dim strData As String = e.Data.GetData(DataFormats.Html)
DoHTMLDrop(strData)
Case "File"
Stop
Case "Bitmap"
Stop
Case "Text"
Stop
End Select
End Sub
For the transparent control....
Public DWBSTCtl As New TransparentCtl
DWBSTCtl.Left = 0
DWBSTCtl.Top = 0
DWBSTCtl.Width = wbData.Width - 20
DWBSTCtl.Height = wbData.Height
DWBSTCtl.AllowDrop = True
AddHandler DWBSTCtl.DragEnter, AddressOf TCtlDragEnter
AddHandler DWBSTCtl.DragDrop, AddressOf TCtlDragDrop
tabData.Controls.Add(DWBSTCtl)
DWBSTCtl.Dock = DockStyle.None
DWBSTCtl.BringToFront()
I found this code somewhere, maybe here, don't know who to give credit to - but he is a better programmer than me.
Public Class TransparentCtl
Inherits Control
Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Get
' Make the control transparent.
Dim MyParams As CreateParams = MyBase.CreateParams()
MyParams.ExStyle = MyParams.ExStyle Or &H20
Return MyParams
End Get
End Property
Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
' Do nothing (because we want to be transparent).
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
End Sub
End Class
Why am I doing this? My app is an inventory/invoice app that has data sheets and FAQ sheets for the items in the inventory. I needed a way for the user populate these sheets with info. They can now go to the item manufactures website & cut, paste, drag, drop from the webpage relevant info. Depending on the type of info dropped I will display the suitable control to display it. RTF, HTML or Text. THANKS to all that spent time thinking of ways to help it would of been nice to get your ideas cuz I was runnin on empty before the transparent control idea finally came to me in the middle of the night.
|
|
|
|
|
Hey i am trying to dynamically create a form in background worker but the after the run the application the form appears as 'not responding?
Please advise
Can we create a form in background worker thread and update the controls in the same thread?
Here is how i am doing it...
Private Sub DoJob(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
Dim f As New System.Windows.Forms.Form
Dim label1 As New System.Windows.Forms.TextBox
f.Size = New System.Drawing.Size(487, 416)
f.Name = "Form6"
f.Text = "Form6"
f.Location = New System.Drawing.Point(0, 0)
label1.Name = "text1"
label1.Size = New System.Drawing.Size(100, 20)
label1.Location = New System.Drawing.Point(54, 37)
f.BackColor = Color.Gray
f.Activate()
f.Controls.Add(label1)
f.Show()
End Sub
After I run it can see form6 ,but in not i responsive state.What am I doing wrong here?
|
|
|
|
|
Hi,
This is a threading issue. Try to move your code from DoWork to a new sub e.g.
1.
Private Sub CreateNewForm()
Dim f As New System.Windows.Forms.Form
Dim label1 As New System.Windows.Forms.TextBox
f.Size = New System.Drawing.Size(487, 416)
f.Name = "Form6"
f.Text = "Form6"
f.Location = New System.Drawing.Point(0, 0)
label1.Name = "text1"
label1.Size = New System.Drawing.Size(100, 20)
label1.Location = New System.Drawing.Point(54, 37)
f.BackColor = Color.Gray
f.Activate()
f.Controls.Add(label1)
f.Show()
End Sub
2.
At the member level add:
Private Delegate Sub delCreateNewForm()
3.
In the DoWork sub invoke the CreateNewForm sub:
Private Sub DoJob(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
Dim d As New delCreateNewForm(AddressOf CreateNewForm)
Me.Invoke(d)
End Sub
Hope this helps
|
|
|
|
|
hey thanks for the help it is working.
So now i will be generating many of the same form this way by using a list of background workers.So will each form be running in its own thread?
Also how can i update the form's gui from the DoWork sub?
|
|
|
|
|
Sohaib_A wrote: So now i will be generating many of the same form this way by using a list of background workers.So will each form be running in its own thread?
No, they won't. Perhaps you didn't get the implied answer: You can't create a window in a background thread, you have to use Invoke to create the window in the GUI thread. (It might be possible to create a window from a thread, but then the thread would have to run a message pump just as the GUI thread does. That would be pointless as you already have a message pump.)
Sohaib_A wrote: Also how can i update the form's gui from the DoWork sub?
The same way; you use Invoke to run the code in the GUI thread.
Alternatively, you put updates in a synchronised queue, and have a timer in the GUI thread read updates from the queue and display them.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Got a reply from Gucha, but its not heklping - same syntax error - could you be simpler? How do you mean"overwriting Text1"? Could you write a ample code?
This table is key to solving other querrie/
Thanks
Am trying to create a simple VB form which can act as a names database... so far the code I have written is thus:
Private Sub Command_Change()
Text1=Text2&""&Text3""&Text4
End Sub
Private Sub Text_Change()
Text2=Lastname
End Sub
Private Sub Text_Change()
Text3=Firstname
End Sub
Private Sub Text_Change()
Text4=Middlename
End Sub
Am getting syntax error reports on text 1.
the original problem was:
Assume the full name of a person in the order of "lastname, firstname, middlename" is text1. Write a VB Progran that will break the fukll name into three components and display he lastname, firstname and middlename in text2, text3, text4 respectively.
Write a program that will capitalize the first letter in a textbox, and make others o be lower case
Write a program that will capitalize the first letter of each word in a textbox, and mke others o be lower case
H
|
|
|
|
|
oburaochola wrote: Got a reply from Gucha
Then reply to Guffa and don't start a new thread.
|
|
|
|
|
Private Sub Command_Change()
Text1=Text2&""&Text3""&Text4
End Sub
Learn to use the spacebar, it adds readability to your code. This is your original "Command_Change" with extra spaces. Can you see your typo that caused the "Syntax Error"?
Text2 & "" & Text3 "" & Text4
I'll give you a hint; Syntax Errors occur when the computer cannot understand what the code is supposed to do. That's usually a typo. In your case, it's right after "Text3". You probably meant this;
Private Sub Command_Change()
Text1 = Text2 & "" & Text3 & "" & Text4
End Sub
Enjoy
I are troll
|
|
|
|
|
Am trying to create a simple VB form which can act as a names database... so far the code I have written is thus:
Private Sub Command_Change()
Text1=Text2&""&Text3""&Text4
End Sub
Private Sub Text_Change()
Text2=Lastname
End Sub
Private Sub Text_Change()
Text3=Firstname
End Sub
Private Sub Text_Change()
Text4=Middlename
End Sub
Am getting syntax error reports on text 1.
the original problem was:
Assume the full name of a person in the order of "lastname, firstname, middlename" is text1. Write a VB Progran that will break the fukll name into three components and display he lastname, firstname and middlename in text2, text3, text4 respectively.
Write a program that will capitalize the first letter in a textbox, and make others o be lower case
Write a program that will capitalize the first letter of each word in a textbox, and mke others o be lower case
H
|
|
|
|
|
When you ask about a homework assignment, you should clairly state this in your question. Assume that your teacher also knows about internet...
You can't assign a string to a TextBox variable. You should use the Text property of the TextBox controls, i.e. Text1.Text instead of just Text1 .
You have got the assignment statement backwards. What's on the right side is assigned to the variable on the left side, so instead of getting the value from Text1 and put in Text2, Text3 and Text4 you are concatenating the values and overwriting the value in Text1.
To split up a string you should look at the Split method in the String class.
For the other assignments, look at the Substring method and the ToUpper method.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello Guffa,
Thanks for your response. This is not a home woerk, but am self tutoring... I dont seem to understand your explanation... could you pleas write a sample code based on your explanation?
Also some codes I see in old tutorials start with
and not as the other one, Could you explain the diffrence?
I
|
|
|
|