 |

|
http://www.codeproject.com/Articles/111430/Grabbing-Information-of-a-Terminal-Services-Sessio
Works perfectly
modified 12-Nov-12 14:46pm.
|
|
|
|

|
Great. Glad you got something that works for you.
|
|
|
|

|
hi experts!
can you help me with this problem?
i am making an id monitoring system.
here is the error.
"The type initializer for 'again.Module1' threw an exception."
thank you very much.
|
|
|
|

|
Not enough information.
We need to see the stack trace and the code for "again.Module1", which I think is a mistake in your code anyway. But, we'd need to see the code where this error pops up.
|
|
|
|

|
I'm doing a homework which i need to create a pizza order form. I've created the form along with the codes but i'm getting errors when debugging it. Like the one below:
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(113) : error BC30451: Name 'txtSurname' is not declared.
This is the code to it:
If ds.Tables("CustInfo").Rows.Count = 0 Then
MsgBox("Number not found in database.")
cmdSave.Enabled = True
txtSurname.Focus()
Exit Sub
I wish i could put more but i'm limited to what i can post cause it long and i have other errors as well!
|
|
|
|

|
You (presumably) are trying to set the focus to some control on your form, but you do not appear to have a control named txtSurname. Check the spelling of your controls.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
Hello !
i have an application in vb.net 2010 , and i'm using System.Net.Mail to send emails.
is there any way to test smtp connection , before begin to send emails .
Thank you !
|
|
|
|

|
The only way to really test it is to try and send an email. Kind of defeats the purpose now, doesn't it?
|
|
|
|

|
thank you , but i need to check if smtp server is ready , and if not i need to display a warning to user and cancel the sending process. If is ready i can begin sending emails.
i have found this code , but doesn't work when i test with a invalid smtp server name:
public bool ValidSMTP(string hostName)
{
bool valid = false;
try
{
TcpClient smtpTest = new TcpClient();
smtpTest.Connect(hostName, 25);
if (smtpTest.Connected)
{
NetworkStream ns = smtpTest.GetStream();
StreamReader sr = new StreamReader(ns);
if (sr.ReadLine().Contains("220"))
{
valid = true;
}
smtpTest.Close();
}
}
catch
{
throw;
}
return valid;
}
|
|
|
|

|
If you give the Connect method an invalid hostname and port that cannot be connected, it'll throw a SocketException with the error code in it.
if the hostname is a real server but nothing is listening on 25, it'll throw a SocketException.
If the hostname is real and 25 is blocked by a firewall, you'll get a SocketException.
Sooo... what's with the lonely little "throw" statement? Remove that and your code will work. That is, assuming that the SMTP server is listening on port 25...
The problem with this code is that you're only testing the server connection, not the ability to send email. Just because the server responds to a connection request does not mean that the credentials given for the SMTP account to send an email will work.
That's why I said the best way to check is to actually send an email.
|
|
|
|

|
Using Vb.NET 2010
=============
I am trying to create a function that given a specific URL (like: www.foo.com/bar.htm) will return a Boolean if there are any JavaScript errors. I would LOVE it to return what those errors are as well, but I only need to have it return a yes/no if there are any.
I've searched high and low for any information regarding this topic and just haven't found anything about detecting if the HTML page has JavaScript errors.
Would anyone have any suggestions, ideas, or code that might be able to help me with this idea?
Thank you in advance!
-== The PogoWolf ==-
|
|
|
|

|
I currently have an XML file that contains about 115,000 codes along with addition information (description, "see also" information, etc), and is about 8.5MB in size. Unfortunately I did not create the file and cannot change it's format; must be used as is.
I've never worked with a file of this size. Just trying to open the file to look at the format was cause slow-down while opening and trying to scroll through it. However, for my application, I need to be able to dynamically update drop-down list with the codes (as the user starts to type in a code), as well as do search for codes.
I'm thinking this file is too large to load into an XDoc object or into a custom sorted list (key=code, value=description). I'm hoping someone has had experience working with similarly large XML files and has some suggestions on the most efficient way to work with a file like this.
Thanks in advanced for any help you can provide.
|
|
|
|

|
How about this ...
1) Load the data into a SQL server table.
2) Have your application access and manipulate the data in the database.
3) Whenever you need the file, then run a routine to export the data from the database to the XML file.
Just a thought.
|
|
|
|

|
A web page I'm trying to automate has come to my attention that it using frames. the source is and link to page is below:
url: http://www.konaeuropeadmin.com/[^]
My code so far...
Dim theElementCollection As HtmlElementCollection = KonaBrwsr.Document.GetElementsByTagName("input")
For Each curElement As HtmlElement In theElementCollection
Dim controlName As String = curElement.GetAttribute("name")
If controlName = "loginname" Then
curElement.SetAttribute("Value", "username")
End If
If controlName = "loginpassword" Then
curElement.SetAttribute("Value", "password")
End If
If controlName = "savepassword" Then
curElement.SetAttribute("Value", "True")
End If
Next
Dim theElementCollection2 As HtmlElementCollection = KonaBrwsr.Document.GetElementsByTagName("input")
For Each curElement2 As HtmlElement In theElementCollection2
Dim controlName2 As String = curElement2.GetAttribute("name").ToString
If controlName2 = "login" Then
curElement2.InvokeMember("Click")
End If
Next
I know this works as I've used the same procedure for all the webpages I'm trying to automate... 15 in total; downloading files automatically.
The problem with this site is that it uses frames, and although I know my code work for a simple HTML form, I have no idea how to repeat this procedure for a framed website.
Someone please help, I've been on this for a while now and simply not working for me.
Thank you all in advance.
|
|
|
|

|
Inside the page (in your link) you will find the following code.......
<html>
<head>
<title>Kona Europe</title>
<frameset rows="92,*">
<frame name="enterpart" scrolling="no" noresize>
<frameset cols="310,*">
<frame name="treeframe" src="http://www.konaeuropeadmin.com/getcountry.htm">
<frame name="basefrm" src="http://www.konaeuropeadmin.com/website/rightframe.htm">
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>
in THAT page (the page in your link - or even ANY other page you wish)
first assess if the FRAME or IFRAME tag is present and if it is then load the SRC file that the individual FRAME SRC points to and then run your code for EACH frame and treat each frame as a separate html document.
If the fields your looking for are there then your code will do what its supposed to and if not then your code shouldnt do anything and you simply continue to the next frame.
If theres NO frames then your code will operate as normal....
See the pseudo code below
'1 Get the ORIGINAL document
'2 look for the FRAME tag (if no frame tags jump to step 10)
'3 in the frame tag look for the SRC attribute/element
'4 load the document using the SRC as the file to load pointer
'5 == YOUR CODE HERE ==
'6 we are done with this document
'7 we are done with this frame
'8 move to the next frame (and repeat till no more frames)
'9 All done - jump to step 12
'10 == YOUR CODE HERE ==
'11 All done - jump to step 12
'12 Finished
|
|
|
|

|
I currently have an array populated with string values and am trying to compare the values in the array to other string values, but I am getting an error. The error message is “Conversion from string "SDrug" to type 'Boolean' is not valid”. Here is the code I have written.
“If IndustrySectorContentArray(IndustrySectorCounter) = "SFinancials" Or "SDrug" Then “.
If I just compare the content in the array to "SFinancials" then I don’t have an issue, but when I add the “Or” command I am getting the error.
Can someone point me in the right direction to get the desired result?
Thanks.
George
|
|
|
|

|
you need to include the whole statement in each side of the comparison like this:
If IndustrySectorContentArray(IndustrySectorCounter) = "SFinancials" Or IndustrySectorContentArray(IndustrySectorCounter) = "SDrug" Then
End If
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|

|
That Solved it. Thanks a lot for your help.
George
|
|
|
|

|
Glad to help
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|

|
Hi,
I am trying to generate a report from a data table with an unknown number of columns at design time. The application allows the user to choose what column to show, and I don't know how to bind a table with an unknown schema. Can someone please give me some points and avice about how to do this?
thanks
kevin
Mickabooh Systems LLC
|
|
|
|

|
You can't.
If the schema isn't known at design-time, the designer can't do anything with it. You're only going ot be able to do that at run-time.
The bigger question should be why that table has an unknown number of columns. Is this really necessary or can the data be represented differently to eliminate this condition.
Do these column have to appear in the report? Is there is a subset of columns that is known? Can these be broken out into a seperate table?
Tons of questions only you can answer...
|
|
|
|

|
Put all the columns in the report and control the visibility/width of the columns based on the users choice! It's still a really ugly requirement!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|

|
I'd recommend creating a "new application" to try implement this technique; that way you won't be bothered with code that has little to do with this particular problem.
You already have the bytes; you can put those in a memorystream[^] and load your image from that stream[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
hy
This function converts byte array to image:
Public Shared Function ByteArrayToImage(ByVal ByteArr() As Byte) As Object
Dim ImageStream As System.IO.MemoryStream
Try
If ByteArr.GetUpperBound(0) > 0 Then
ImageStream = New System.IO.MemoryStream(ByteArr)
Return Image.FromStream(ImageStream)
Else
Return Nothing
End If
Catch ex As Exception
Return Nothing
End Try
End Function
and this convert back:
Public Shared Function ImageToByteArray(ByVal NewImage As Image) As Object
Dim ImageStream As System.IO.MemoryStream
Dim ByteArr() As Byte
Try
ReDim ByteArr(0)
If NewImage IsNot Nothing Then
ImageStream = New System.IO.MemoryStream
NewImage.Save(ImageStream, Imaging.ImageFormat.Jpeg)
ReDim ByteArr(CInt(ImageStream.Length - 1))
ImageStream.Position = 0
ImageStream.Read(ByteArr, 0, CInt(ImageStream.Length))
End If
Return ByteArr
Catch ex As Exception
Return Nothing
End Try
End Function
+You need DBNull check when the column allow nulls.
|
|
|
|

|
'In DA_Company'
Function Company_Save(ByVal M_Model_DA As Model.M_Company) As String
Try
connection_enable()
cmd = New SqlCommand()
cmd.CommandText = "SP_HR_Company_Insert"
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@Company_Logo", SqlDbType.Image).Value = M_Model_DA.Company_Logo
err_message = cmd.ExecuteNonQuery()
Catch ex As Exception
err_message = ex.ToString()
End Try
Return err_message
End Function
'In BL_Company'
Function Company_Save(ByVal M_Company_BL As Model.M_Company) As String
Try
DA_Company = New DataAccess.DA_Company()
error_message = DA_Company.Company_Save(M_Company_BL)
Catch ex As Exception
error_message = ex.ToString()
End Try
Return error_message
End Function
'In M_Company'
Public Property Company_Logo() As Byte
Get
Return Me.CompanyLogo
End Get
Set(ByVal value As Byte)
Me.CompanyLogo = value
End Set
End Property
'In Frm_Company'
Private Sub Company_Save()
Try
BL_Company = New BusinessLogic.BL_Company()
M_Comapny = New Model.M_Company()
M_Comapny.Company_Logo = Convert.ToByte(browseCompanyLogo.Value)
error_message = BL_Company.Company_Save(M_Comapny)
If error_message > 0 Then
MessageBox.Show("Complete Save")
Company_GridView_FillData()
End If
Catch ex As Exception
MessageBox.Show(ex.Message.ToString())
End Try
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Company_Save()
End Sub
But It Shows Input Stream was not in a correct format . Why ? please !
|
|
|
|

|
heinhtataung wrote: Why ?
'cause an exception occured. Can you point out the line *where* it occurs?
I'd guess it happens on this line;
M_Comapny.Company_Logo = Convert.ToByte(browseCompanyLogo.Value)
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|

|
I would start at MSDN Development for beginners[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|

|
ill try this thankyou
|
|
|
|

|
Casey Edison wrote: how to create my own AI program Even the Japanese struggled with that.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
I don't want to make a very complex one just one that can make replys and activate event from speech, not to complex ofcourse i know there is AI programs you can download like this like helpful AL like that basically.
|
|
|
|

|
OK, so what exactly are you asking for here?
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
I want to be able to make a basic program that i can run. I want it to be able to use speech recognition but i dont mind using text, with some sort of speech from the AI. like siri basically.....
i understand this might sound like facepalm. I know Siri was created by proffesionals over years under the CALO project. I obviously dont want it as complex as Siri.
i uderstand for actually siri the framework is python and java i dont mind changeing programming languages aslong as i can create this myself, the language doesnt matter.
|
|
|
|

|
All these things are possible, but it would be quite a challenge for someone who is still learning programming. The first thing you need to do is study your language of choice and get comfortable with building simple programs.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
i can do basic things i understand variables can make a simple replica of notepad, and number calculator but a basic one and just basic programs really im also tryna learn how to make a media player at the moment, but its just getting off the ground with this is hard.
|
|
|
|

|
Casey Edison wrote: just getting off the ground with this is hard. No one said it would be easy; programming requires considerable thought and effort. Don't assume that you can turn out a complex application after just a few days. The only way to produce great, or even good, work is practice, practice, practice.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
i know this but nothing wrong with asking for help then i can practice
|
|
|
|

|
Casey Edison wrote: nothing wrong with asking for help Help with what? All we know is that you want to write some sort of AI program in Visual Basic. Unless you explain exactly what you are having difficulty with we cannot suggest much more than: "try some Google searches for AI".
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
i can do basic things i understand variables can make a simple replica of notepad, and number calculator but a basic one and just basic programs really im also tryna learn how to make a media player at the moment, but its just getting off the ground with this is hard. Do you know were i could ind out how an AI works how the code links etc.
|
|
|
|

|
Casey Edison wrote: i can do basic things i understand variables can make a simple replica of notepad, and number calculator but a basic one and just basic programs really im also tryna learn how to make a media player at the moment, but its just getting off the ground with this is hard. Do you know were i could ind out how an AI works how the code links etc.
An AI is a few levels complexer than a notepad. Google for "Eliza", there must be some chatbot-code around that you could build on.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
Hi, anyone can give me idea on how to do this? I'm used to gridview for updating multiple data to sql table. But how can i insert to sql table a list of data from a table/form? Its a situation where a lecturer wants to register a list of student for a subject.
|
|
|
|

|
One way would be to issue INSERT commands, using Sql. Another way would be using the TableAdapters. Both approaches are described here[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
sorry.. still cant understand how it works.
i have a html table where there are 3 columns studentID,studentName, courseName. There ada 10 rows of textbox for each column. Can u explain how can i use the one that u gave me? I'm not using gridview because my data doesn't exist in the sql table yet. Hope my explanation is clear because my english is not that good.. TQ for the reply... been waiting every minutes for reply
|
|
|
|

|
zaimah wrote: sorry.. still cant understand how it works.
i have a html table where there are 3 columns studentID,studentName, courseName. There ada 10 rows of textbox for each column. Can u explain how can i use the one that u gave me?
That explanation would not fit in a single post.
zaimah wrote: I'm not using gridview because my data doesn't exist in the sql table yet.
You'd need to CREATE TABLE before the INSERT. Both are done using Sql, a separate language with it's own syntax. The other method that's being described in the documentation, is the TableAdapter-approach, where the framework generates these commands on your behalf.
zaimah wrote: been waiting every minutes for reply
As opposed to waiting, find yourself a tutorial, an article, anything that gets you moving in the right direction. It might take a few days before you get a satisfactory answer.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
sorry, maybe my explanation is not clear.
I already have a table "student". And i have a web form where the lecturer can insert a list of new student. I cannot use gridview not because the table doesn't exist, just the data does not exist yet until the lecturer key-in the data.
i know how to use sqldataAdapter to retrieve value from sql table and put it in a textbox. But that is if the data exist. Will try to look for tableadapter.
Sorry again, i waited and at the same time been searching for solution all over the place for any articles related to my problem.
TQ for your reply..
modified 31-Oct-12 9:19am.
|
|
|
|

|
zaimah wrote: I already have a table "student". And i have a web form where the lecturer can insert a list of new student. I cannot use gridview not because the table doesn't exist, just the data does not exist yet until the lecturer key-in the data.
You'd also need a list that contains the students that are linked to a course, and execute insert-commands to fill that. It also means that the student will have to exist, before this list can be saved.
zaimah wrote: i know how to use sqldataAdapter to retrieve value from sql table and put it in a textbox. But that is if the data exist.
That's an update. You'll need something similar for an insert.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
Its a bit confusing rite now for me. The lecturer job is to register the student to the table "student". What do u mean by the student will have to exist before the list can be save? Do u mean i have to type manually to the table "student"?
Been trying to find Insert from html table to sql table but keep on seeing from sql table to html table...
Can tableadapter used for webform?
|
|
|
|

|
zaimah wrote: The lecturer job is to register the student to the table "student". What do u mean by the student will have to exist before the list can be save? Do u mean i have to type manually to the table "student"?
The list you are trying to save is a combination of the student, and some other record. Before you can save anything that's linked to a student-record, the student-record must exist in the database.
So, first the student is "inserted", then the rest.
zaimah wrote: Been trying to find Insert from html table to sql table but keep on seeing from sql table to html table...
Data is seldom saved in the same way as it is presented. Can you list the other tables that you have besides the student-table?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
that is what im trying to do.. Insert the student.. How can i do that? Insert a list of student? after that, it would be easier for me to use UPDATE because the student exist in the student table.
I have table for student so i can set their course in table course.
|
|
|
|
 |