|
Hi, I'm trying to write a fairly program, but it requires me to take individual characters from a string. For example, say the string is
"I'm confused" the program needs to take say the fifth character "c" from "I'm confused". I haven't done much programming and what I did do was several years ago, so I don't remember or know how to accomplish this in basic... So, any help would appreciated.
you can email me at csel.poiuy@gmail.com
|
|
|
|
|
nm i figured out how... sorry to bother you guys lol
|
|
|
|
|
I'm looking for convertion source code (etc. word , powerpoint , pdf) to html by vb.net or asp.net
It's important! help me please
Thanks.
|
|
|
|
|
Pookky wrote:
by vb.net or asp.net
I'll also mention that ASP.NET is not a language, it's a platform.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I want to know how to save the updated values of the datagrid that has its values from 2 different tables.
i need it to be done by one button click,i am using vb.net form
|
|
|
|
|
You can iterate through the rows to work out which ones have changed, then insert those changes back into the tables. OBviously this involves one stored procedure that has at least two statements in it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Does anyone have any examples of communicating with a serial port in VB Express? I could sure use some help.
|
|
|
|
|
Do an article search on serial port .NET on The Code Project website and you'll see at least two articles that go into some depth. I don't believe there is any native support in Visual Studio for serial ports.
...Steve
|
|
|
|
|
There is in 2005 in the System.Io.Ports namespace.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey - that's another excuse for me to start using it. Thanks Dave.
...Steve
|
|
|
|
|
I would like to know abt the code for Printing on a Predesigned Bill and the data for the respective fields will be retrieved from Oracle
Pls mail me how to code for Printing on the Bill layout ie image fill in VB6.0
Regards
Anup Singh J.
** A Fighter Never Loses !!!!
|
|
|
|
|
I don't think there is a print preview control in VB6.0
Perhaps you should look at Crystal Reports?
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Is there any example in VB.Net which shows how to create a class dynamicaly at runtime?
|
|
|
|
|
As it happens I've just done some work where I was doing this kind of thing and I also did some further experiementation after completing the project. this example is in C# but you should be able to convert it to VB easily enough
using System.Reflection;
string continentFactory = "PatternsTest.AfricaFactory";
object target = null;
Binder binder = null;
string methodName = null;
object[] args = null;
Type continentType = assembly.GetType(continentFactory);
target = null;
methodName = null;
args = null;
ContinentFactory continentInstance = (ContinentFactory) continentType.InvokeMember(
methodName,
BindingFlags.DeclaredOnly |
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.CreateInstance,
binder,
target,
args
);
Kevin
|
|
|
|
|
Hi all...
Since I upgraded to .Net from VB 6, when creating public classes with public events I use:
<br />
Public Event MyEvent(ByVal ParameterName as Type)<br />
In one project this didn't work, the event sometimes does not raise, I searched the MSDN and I found:
Note: Non-shared events should not be raised within the constructor of the class in which they are declared. Although such events do not cause runtime errors, they may fail to be caught by associated event handlers. Use the Shared keyword to create a shared event if you need to raise an event from a constructor.
I changed the statement to be like:
<br />
Public Shared Event MyEvent(ByVal ParameterName as Type)<br />
It worked fine.
I'm not familiar with what Shared does, but should I use it with every Public Event declaration?
|
|
|
|
|
The Shared declaration makes a variable, event or method static. In other words, you do not need to create a class instance to access a Shared member.
Shared allows you to trap an event raised in a class constructor because the class instance itself is not yet fully initialized, but you do not need an instance because the event is static.
But it is not a good idea to use Shared in most cases, because typically you want events and property vcalues to be associated with a specific instance. When you raise a shared event, the application has no way of knowing which, if any, instance the event was raised from. Similarly, when you set the value of a shared property, the value will be set in any and all instances of the class.
See the MSDN, it describes the behavior of Shared members in detail.
|
|
|
|
|
rwestgraham wrote:
But it is not a good idea to use Shared in most cases, because typically you want events and property vcalues to be associated with a specific instance. When you raise a shared event, the application has no way of knowing which, if any, instance the event was raised from. Similarly, when you set the value of a shared property, the value will be set in any and all instances of the class.
Thank you rwestgraham for your reply...
My problem is i'm not rasing the event from within the constructor, i noticed that the event raised one of two times i click the button that raise the event, i posted the code below maybe this will help to understand the problem, the code is not completed 'cause i stopped once i noticed this problem:
The event that does not raise is the DataArrival event
Private Class UserConnection
Private __TcpClient As TcpClient
Private __ConnectionID As Integer
Private __ReadBufferSize As Integer
Private __ReadBuffer As Byte()
Public Event DataArrival(ByVal ConnectionID As Integer, ByVal rDataByte As Byte(), ByVal rDataStr As String)
Public Event ConnectionLost()
Public Event ConnectionClosedByClient()
Public Sub New(ByVal ClientConnection As TcpClient, Optional ByVal ReadBufferSize As Integer = 255)
__TcpClient = ClientConnection
__ReadBufferSize = ReadBufferSize
ReDim __ReadBuffer(__ReadBufferSize)
Me.__TcpClient.GetStream.BeginRead(__ReadBuffer, 0, __ReadBufferSize, AddressOf StartRead, Nothing)
End Sub
Private Sub StartRead(ByVal AR As IAsyncResult)
Dim BytesRead As Integer
Dim strMessage As String
Try
SyncLock __TcpClient.GetStream
BytesRead = __TcpClient.GetStream.EndRead(AR)
End SyncLock
strMessage = Encoding.ASCII.GetString(__ReadBuffer, 0, BytesRead)
RaiseEvent DataArrival(__ConnectionID, __ReadBuffer, strMessage)
SyncLock __TcpClient.GetStream
ReDim __ReadBuffer(__ReadBufferSize)
__TcpClient.GetStream.BeginRead(__ReadBuffer, 0, __ReadBufferSize, AddressOf StartRead, Nothing)
End SyncLock
Catch e As SocketException
MessageBox.Show(e.ToString, e.NativeErrorCode.ToString)
End Try
End Sub
Public Sub SendData(ByVal Data As String)
SyncLock __TcpClient.GetStream
Dim writer As New IO.StreamWriter(__TcpClient.GetStream)
writer.Write(Data)
writer.Flush()
End SyncLock
End Sub
Public Sub SendData(ByVal Data As Byte())
SyncLock __TcpClient.GetStream
Dim writer As New IO.StreamWriter(__TcpClient.GetStream)
writer.Write(Data)
writer.Flush()
End SyncLock
End Sub
Public Property ConnectionId() As Integer
Get
Return __ConnectionID
End Get
Set(ByVal Value As Integer)
__ConnectionID = Value
End Set
End Property
End Class
|
|
|
|
|
The DataArrival event is only raised from the StartRead function. StartRead is not called by any of the other class member functions, and it is declared Private so you cannot call it externally. I would guess that the event is never raised because StartRead is never executed. ???
|
|
|
|
|
Okay .... this is a really stupid question...
Some time ago I made a WEBservice for a company on my server. The webservice takes an XMLdokument and does some magic. Several other servers is involved. To bad they are really really slow ...
My client creates the dokument and send it to WEBservice and then clients app is just waiting ... wainting and waiting until it gets a WEBService timeout. Sooo ... Can I set timeout-value somewhere or do I have to think it all over again? Maybe client shall send me smaller XMLS:s and call WEBservice more frequent to avoind the timeout?
Fast responses please ....
Regards // Maw
|
|
|
|
|
How to grab a form's content into another form? I was to show a form in another form.
|
|
|
|
|
The form which you want to show in another form must have "SetTopLevel(False)", then you can add this form like any other control.
public Class InnerForm<br />
inherits System.Windows.Forms.Form<br />
<br />
Public Sub New()<br />
MyBase.New()<br />
InitializeComponent()<br />
<br />
Me.SetTopLevel(False)<br />
End Sub<br />
End Class<br />
<br />
public Class OuterForm<br />
inherits System.Windows.Forms.Form<br />
<br />
Public Sub AddInner(innerf as InnerForm)<br />
me.controls.add(innerf)<br />
innerf.show()<br />
End Sub<br />
End Class
hope this will help you
|
|
|
|
|
Hello
I'd like to visualize some data in a datagrid. The data is structured into two different classes.
After the startup of the form I'd like to display only the data of the first class and then I'd like to display a plus-minus symbol in the row header where the user can click and disply the data of the subclass. Here a small example. Main Class: Drinks and Food, Subclasses for Drinks: Beer, Coke, Sprite and for Food: Hamburger, French Fries.
How can I only display the two rows Drinks and Food at startup and then when the user clicks on the plus-minus symbol in the row header of Drinks the program will also display sub categories Beer, Coke and Sprite directly under the row Drinks?
To me it seems to be something like a TreeView but I should be able to insert multiple columns and I'd like to display the same colums in the main class as in the sub classes.
I tried it with data relations but this will only generate a separate table for the sub classes and will not display it in the same datagrid together with the main class.
Does anybody know an answer?
Thanks in advance
Dave
|
|
|
|
|
I have a windows forms application where I need to download or get access to a response stream for a requested URL (In my case a gif file). The website uses forms authentication and therefore requires an authentication cookie and no resources on the site can be downloaded without first being redirected to a login page. I found this article Screen Scraping, ViewState, and Authentication using ASP.Net[^] from which I converted C# to VB.NET (the main difference is that the example code is run from an asp.NET application). However when I try to run my code I get a WebException (500) Internal Server Error.
Here is my code, does anyone have any suggestions or hints/another way of doing this?
<br />
Dim strPageURL As String = "http://localhost/MySite/images/uk.gif"<br />
Dim strLoginURL As String = "http://localhost/MySite/login/login.aspx"<br />
<br />
'first, request the login form to get the viewstate value<br />
Dim webReq As HttpWebRequest = DirectCast(WebRequest.Create(strLoginURL), HttpWebRequest)<br />
webReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"<br />
<br />
webReq.Credentials = New NetworkCredential(Me.ContainerForm.UserName, Me.ContainerForm.Password)<br />
<br />
Dim stmResponseReader As New StreamReader(webReq.GetResponse.GetResponseStream)<br />
Dim strResponseData As String = stmResponseReader.ReadToEnd<br />
stmResponseReader.Close()<br />
<br />
'extract the viewstate value and build out POST data<br />
Dim strViewState As String = ExtractViewState(strResponseData)<br />
Dim postData As String = [String].Format("__VIEWSTATE={0}&txtUsername={1}&txtPassword={2}&btnLogin=Login", strViewState, Me.ContainerForm.UserName, Me.ContainerForm.Password)<br />
<br />
'have a cookie container ready to receive the forms auth cookie<br />
Dim cookies As New CookieContainer<br />
<br />
'now post to the login form<br />
webReq = DirectCast(WebRequest.Create(strLoginURL), HttpWebRequest)<br />
webReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"<br />
webReq.Credentials = New NetworkCredential(Me.ContainerForm.UserName, Me.ContainerForm.Password)<br />
webReq.Method = "POST"<br />
webReq.ContentType = "application/x-www-form-urlencoded"<br />
webReq.CookieContainer = cookies<br />
<br />
'write the form values into the request message<br />
Dim requestWriter As New StreamWriter(webReq.GetRequestStream())<br />
requestWriter.Write(postData)<br />
requestWriter.Close()<br />
<br />
'we don't need the contents of the response, just the cookie it issues<br />
webReq.GetResponse().Close()<br />
<br />
'now we can send out cookie along with a request for the protected page<br />
webReq = DirectCast(WebRequest.Create(strPageURL), HttpWebRequest)<br />
webReq.Credentials = New NetworkCredential(Me.ContainerForm.UserName, Me.ContainerForm.Password)<br />
webReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"<br />
webReq.CookieContainer = cookies<br />
<br />
'ERROR OCCURS HERE<br />
Dim stmResponse As Stream = webReq.GetResponse().GetResponseStream()<br />
<br />
Me.PictureBox1.Image = Image.FromStream(stmResponse)<br />
Jim
|
|
|
|
|
I plan to develop a com+ serviced component in Windows 2000 server. Now my requirement is that the deployed serviced component should be available to client applications developed as a Windows Applications (Winforms) and running on Client machines in the network.
ie. How should i access the serviced component in a Windows Application (winforms) ???
I plan to deploy some serviced components, which i want to access from ASP.net applications and also through Windows applications ???
Could anyone help ???
Chandru
|
|
|
|
|
Export the service component installation setup and embed it in desktop setup application. when you application will run it will prompt the user with the server name to provide which you will save in the registry or any ini file. then in the code u have to use
object=createObject("project.class",ServerName)
and it will create the object for that server.
test and let me know if any thing goes wrong.
|
|
|
|