|
Thanks for your reply Dave
I havent tried that
Could you tell me how would i use it?
The variable that i need would be in the main form or a global variable in the main project and needs to be accessed from this custom controls
Id rather not to create a public property on the control and assign a value from the main app, since this control is already in use, and i would have to modify all of those apps
Detailed Info:
I have a custom control that connects to a web service, ive been using this control in some applications and has worked fine, but now i need to keep session info on the server side which hosts the web service, but the controls dont keep session info automatically, so, using the CookieContainer of the webservice class created for me using the option "Add Web Reference" the control is able to access the same session that the control started when it first connected, but when i access from another of my custom controls, there is no session info, and a new session is started, to access the same session, i have to share the CookieContainer of the control that first connected to the web service to every control that is on my app, thats the variable that i need to share
If you know of any better way to accomplish this, ill appreciate it
Thanks again
Alexei Rodriguez
|
|
|
|
|
AlexeiXX3 wrote: Could you tell me how would i use it?
Private Class MyBindClass
Private Shared someVariable As Integer
AlexeiXX3 wrote: The variable that i need would be in the main form or a global variable in the main project
You can't do that because the class you created will have no idea what code called it. And, it shouldn't even care.
AlexeiXX3 wrote: I have a custom control that connects to a web service, ive been using this control in some applications and has worked fine, but now i need to keep session info on the server side which hosts the web service, but the controls dont keep session info automatically, so, using the CookieContainer of the webservice class created for me using the option "Add Web Reference" the control is able to access the same session that the control started when it first connected, but when i access from another of my custom controls, there is no session info, and a new session is started, to access the same session, i have to share the CookieContainer of the control that first connected to the web service to every control that is on my app, thats the variable that i need to share
If you know of any better way to accomplish this, ill appreciate it
This would have helped from the very start. Web Services are not my area of expertise. As I understand it, Web Services are meant to be static methods and stateless.
Off the top of my head, you'd have to have an external store to keep session data persisted and pass a session id back top the client on the first request. The client would then have to pass it's session ID back to the web service on every call. Anything you wanted to save between calls in an individual session would have to be serialized into the persistant storage and deserialized into every call.
Storing values to be used between multiple sessions at the same time would also require an external storage to persist the shared variable, like a database table.
But, that was all off the top of my head with the limited knowledge I have of web services. I'd probably start reading something like this[^] if I wanted to find out more.
|
|
|
|
|
As i am looking at the code to print all the files existing in a folder using VB.NET. Can any body help me out on this issue.
SaiRamk@vjil.com
|
|
|
|
|
Check out the methods on 'System.IO.Directory'.
|
|
|
|
|
Hi guys.
I have a problem with my dropDownList.
I have a dropdownlist(name DropDownList1) in vb.net(Default.aspx.vb) preloaded with values from the database that run perfectly each time I run the page.Now the problem I get is, it seems it doesnt recognice one of the values given to print.Watch how [Branch] a string.
When I select a value from the dropdown, it must go to the database and look for that value and print vertain fields. See below
Imports System
Imports System.Data
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Dim da As OleDbDataAdapter
Dim cn As New OleDbConnection
Dim rid As OleDbDataReader
Dim cm As New OleDbCommand
Dim cb As OleDbCommandBuilder 'to create Update, Insert and Delete commands for DA
'Dim zz As OleDbConnectionStringBuilder
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
cn = New OleDbConnection("Provider = Microsoft.Jet.oledb.4.0; data source = C:\TelephoneList.mdb")
cn.Open()
cm = New OleDbCommand("Select * from [Other Branches] where [Branch] = '" & DropDownList1.SelectedValue & "'", cn)
cm.Connection = cn
If cn.State = ConnectionState.Open Then
cn.Close()
End If
cn.Open()
rid = cm.ExecuteReader
While rid.Read
LabelBranch.Text = rid("[Branch]")****problem here
End While
rid.Close()
cn.Close()
Application.Lock()
End Sub
End Class
Please help guys
kagiso
|
|
|
|
|
Have you stepped through the code to see what's returned in that DataReader? If nothing is returned, then you're not going to get anything in that label. Even worse, you could end up getting something, but since your replacing the contents of the label with each record returned by your query, if the last record is empty, you'll get an empty label.
|
|
|
|
|
how can i make a text-2-speech application for "Pashto" Language.Thats an eastrn language.our sujjest the basic steps to make it.
anybody help me pleeeeeeeeeeeeeeez!
|
|
|
|
|
The basic steps have been suggested to you several times. Fact is, it's a big, big project, and you need more help than you're going to get from a forum reply, to do it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Stop spamming for forums with the same question over and over again. You will NOT find a step-by-step guide to putting a text-to-speech library together. This is a University level research project you're talking about.
|
|
|
|
|
What is the code to disable a tab control ?
|
|
|
|
|
tabcontrol.enabled = false
The name is Sandeep
|
|
|
|
|
But the whole tab option gets disabled please give me the code to just disable tab page 1 then when the user is done with that tab page one and clicks ok , tab page 2 becomes available and so forth
How do i just disable the pages and not the whole TabPage
|
|
|
|
|
You can't disable just one tab. You have to remove the tabpage from the control, then re-add it when you want it enabled.
|
|
|
|
|
Morning everyone. i have a Datagrid,and i want to Display record based on Column "Num_key" in my Table.i have a Button to Search and a Text Field to enter the num_key for searching. i wrote the following code.
<br />
If OleDbDataAdapter2.SelectCommand.Parameters(CStr("Num_key")).Value = txtnum_key.Text Then<br />
OleDbDataAdapter2.Fill(DSq1)<br />
ElseIf DSq1.Tables("ValRoll").Rows.Count = 0 Then<br />
MessageBox.Show("Township not Found")<br />
<br />
End If<br />
am new to vb.net,Please Help
Vuyiswa
|
|
|
|
|
Hi Vuyisma,
First you need to actually query the datasource. For that to work you need to feed a parameter. You almost got it right, except that you are trying to use it in an If sentence, which won't work, because it doesn't return anything, it is only meant to accept a value.
So loose the If bit for now:
OleDbDataAdapter2.SelectCommand.Parameters("Num_key").Value = txtnum_key.Text
(As you can see, I removed the Cstr() bit, because it was redundant)
Then you correctly tried to fill the dataset:
OleDbDataAdapter2.Fill(DSq1)
This just didn't return any results because the parameter never got determined. If you change your code like above, the dataset will be filled with some data if the Num_key was an existing one.
At this point you can check:
If DSq1.Tables("ValRoll").Rows.Count = 0 Then MessageBox.Show("Township not Found")
This check will only work however if you remember to empty your dataset before each query with DSq1.Clear() , because a dataset will retain its data from the previous query.
Hope this helps you,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks man my mistakke, i was supposed to configure the query to accept the unknown parameter like this
<br />
SELECT ID, Lis_key, Erf_NO, Prop_Address, Own_Name, Num_key, Site_Value, Improvements_value, Improved_value FROM ValRoll WHERE (Num_key = ?)<br />
So after that it worked very well. thanks man.
Kind Regards
Vuyiswa
Vuyiswa
|
|
|
|
|
Hi Vuyiswa,
I will tell what the problem is, but I strongly advise you to take a look at this link: http://www.w3schools.com/sql/default.asp
On this website you will find a simple but free SQL tutorial. It will help you a great deal if you can see yourself what is wrong in this code, and it is invaluable if you want to develop yourself in coding.
Vuyiswamb wrote: 'Num_key' is not contained by this OleDbParameterCollection.
This is the actual problem. A little SQL 101: SQL queries a database. The query you just posted is a nice example of a simple query: SELECT certain columns FROM a table in the database. This query however will simply return everything it finds, and because we are only interested in certain data, we need to write a condition into the query. This is done by adding a so called WHERE clause at the end. In your case it would become:
SELECT ID, Lis_key, Erf_NO, Prop_Address, Own_Name, Site_Value, Num_key, Improvements_value, Improved_value FROM ValRoll WHERE Num_key = @NumKey the @ character tells the query that this is a so called parameter (a variable value). What you write after the @ character doesn't matter, it is just so that you know what value to enter there. So the first line of your code changes only slightly:
OleDbDataAdapter1.SelectCommand.Parameters("@NumKey").Value = txtnum_key.Text
In other words, the error was thrown because you tried to pass a parameter to a query that didn't contain one.
Please try this, and I strongly recommend typing in sql tutorial in Google.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thannk you man, my mistake, i saw the Mistake and Fixed it, that is why i modified the thread. i know SQL just i was Clumsy. sorry about that. thank you Johan
Vuyiswa
|
|
|
|
|
Hi
I have a windows application I developed using visual studio 2005 that looks very good on XP operating system. I have just got a vista laptop and now ran the exe on the laptop and it looks very different. All washed out. Can I make a change to my application to keep the XP look on vista? Thanks in advance
|
|
|
|
|
That depends on if Vista still has the older control libraries in it. i have no idea if it does or doesn't. I don't use Vista at the moment.
If it does, then it should just be a matter of creating/changing your applications manifest file. Read this[^].
|
|
|
|
|
Hi.
Where the ConnectionString In crystal Report has saved?
It isn't in app.config.
Suppose I have Report, My SQL Server Instance name is 'Mehrdad',
I want to run this report in another machine that SQL Server Instance name is 'John'.
Now it doesn't work properly and an error occured (because of ConnectionString)
I have changed the ConnectionString in app.config, but there was no affect.
Best wishes
|
|
|
|
|
Have you looked in the Designer Generated code section of your form?
|
|
|
|
|
Well here I am again, heres what Im trying to to. I have a Folder Ive created in a specified path withint the application, there will be more than one file in said directory so heres what I need to do:
This folder is used to hold the ErrLog.txt file I created in the application to log errors that have happened, I am now wanting to limit the size of this file to 10MB, so I need to be able to retrieve the current file being used (whether it be ErrLog1.txt, ErrLog2.txt, and so on) then check the size of this file and if its too big then close it, open a new file (with the next number appended to it) and use that file until it reaches the size limit, and so on.
Ive done some searches on Google (as well as some other forums Im a member of) and havent found anything real useful, so I always return to the one place I can find answers, CP. Anyone got some ideas/links/samples I can look at and use to accomplish this?
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
This is easy if you think about it.
You don't need the log file open all the time. You open it, write your message, close it. Simple. Now, all you have to do is check the size of the file BEFORE your open the log and write to it. The FileInfo class comes in handy for that. If the size of the current logfile is greater than 10MB, increment the filename and use the new name for the log file.
|
|
|
|
|
Well I've gotten that far but am having a few issues: Figuring out what is the file currently being used (as theoretically there could be multiple files after years of use), how to determine the number at the end of the file). I already have coded to determine the size of the file. I may be over-complicating this, sometimes I do that, but I seem to have hit a wall on this.
"Well yes, it is an Integer, but it's a metrosexual Integer. For all we know, under all that hair gel it could be a Boolean."
Tom Welch
|
|
|
|
|