|
Hi
I've got a desktop application that uses a WebBrowser control to let users access their Gmail accounts. I have multiple users though, and every time a users logs out of the desktop application, and a new user logs in, the WebBrowser goes to the previous users email account. How can I reset the the WebBrowser completely so that it navigates to the Gmail homepage? I tried clearing the cookies as well as the temporary internet files folder (I tried this programmatically in code as well as using the Windows way), but still no luck. It still navigates to the previous users email account. What is strange though is that when I close down the desktop application completely and run it again, the WebBrowser navigates to the Gmail homepage.
Any ideas?
|
|
|
|
|
after the user finished, set the instance of the web browser to null then call the garbage collector System.GC.Collect();
|
|
|
|
|
Thanks for the quick reply.
Okay so now when the next user tries to access his/her email, I call the following again:
this.browserGmail = new System.Windows.Forms.WebBrowser();
this.browserGmail.Location = new System.Drawing.Point(5, 53);
this.browserGmail.MinimumSize = new System.Drawing.Size(20, 20);
this.browserGmail.Name = "browserGmail";
this.browserGmail.Size = new System.Drawing.Size(914, 616);
this.browserGmail.TabIndex = 4;
browserGmail.Navigate("mail.google.com/mail");
This seems to work, but the browser doesn't get directed to any page, it just shows me a white screen?
So I tried:
browserGmail.CreateControl();
browserGmail.Update();
Still no luck
|
|
|
|
|
I did a research, i read the description of all the properties and methods in the WebBrowser class, and i didn't find a thing , i only thing that i manage to get is the credentials of users are saved on the disk not in the memory, and each application has its own place to save them with encryption, who manage this thing and how :S i don't know, sorry.
|
|
|
|
|
Hi,
I have drawn rectangle using picture box. Now i like to keep the work done and like to close the application. again when i open the application the previous work should come.
How to do this...
Please help me....thanks.
|
|
|
|
|
See here: Using Settings in C#[^]
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hi sir,
I am using below in VC++
Combo.SetEditSel(i,i++);
Combo.SetDroppedWidth(j);
Combo.ShowDropDown();
How can i use the same in C#
Thanks
Raj
|
|
|
|
|
Just use the .Net ComboBox[^] in the same way.
It's time for a new signature.
|
|
|
|
|
I have a long string which I need to check its existence in database. The string is follows:
string str = AU000AC20095=YBAX ,XS0088980494=MLIL,IT0003953350=HVBT
To make it sql compliant like.
Following is the sql query I need to execute:
SELECT ISIN_Universe_Id,ISIN,RIC,DateCreated from ISIN_Universe where ric in
('AU000AC20095=YBAX','XS0088980494=MLIL','IT0003953350=HVBT')
So I declared a varchar variable and passing this string. In C# code, i am using the following function for this:
public string CreateRICList(RICObject[] ricobj)
{
StringBuilder sb = new StringBuilder();
sb.Append("'");
for (int i=0; i<=ricobj.Length - 1; i++)
{
sb.Append("''");
sb.Append(ricobj[i].RIC);
sb.Append("''");
sb.Append(",");
}
string lstrics = sb.ToString();
if (lstrics.EndsWith(","))
lstrics.Replace(",","'");
return lstrics;
}
However, the string is not forming correctly. Is there any issue with the above code? Or is there any other method which I can pass the whole string at a stretch? Please help.
This is my stored procedure:
EXEC ('SELECT ISIN_Universe_Id,ISIN,RIC,DateCreated from ISIN_Universe
WHERE RIC IN ( ' + ''+ @LISTOFRICS + ''+ ')
AND DATECREATED > ''' + @PREVDAY + ''' AND DATECREATED < '''+@NEXTDAY+'''')
Thanks
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
The issue fixed. The string manipulation function refactored as follows:
StringBuilder sb = new StringBuilder();
for (int i=0; i<=ricobj.Length - 1; i++)
{
sb.Append("'");
sb.Append(ricobj[i].RIC);
sb.Append("'");
sb.Append(",");
}
string lstrics = sb.ToString();
if (lstrics.EndsWith(","))
lstrics = lstrics.Remove(lstrics.LastIndexOf(","),1);
return lstrics;
Probably it will help somebody.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi...
I want to display analog clock.
I have a textbox . once I enter time in textbox and click button, the same time should be set on analog clock.
how would I proceed in windows application in C#.net.
I basically belong to webapplication community.
thanks,
By:
Hemant Thaker
|
|
|
|
|
|
Hi sir,
In VC++ we use str.Find();
How can we use the same in C#
Its working good in VC++
Here is the VC++ code i did:
CString strvalue;
CString strTemp;
for()
{
if(strTemp.Find(strvalue)==0)
m_ctrlCombo.AddString(strTemp);
}
I am trying the same in C#
But in C# we dnt have str.Find(),any other method to find it
Here is wat i am trying
ArrayList List = new ArrayList();
List.Add("AAA");
List.Add("AA");
List.Add("BB");
List.Add("BB");
for (int i = 0; i < List.Count; i++)
{
string value = List[i] as string;
if(value.Equals("AA"))
comboBox1.Items.Add(value);
}
but i am getting all the value from ArrayList.
Any idea
Thanks
Raj
|
|
|
|
|
You must try this out, if u really want to iterate :
ArrayList List = new ArrayList();
List.Add("AAA");
List.Add("AA");
List.Add("BB");
List.Add("BB");
foreach (string item in List)
{
if (item.Equals("AA"))
comboBox1.Items.Add(item);
}
else, u can always go with this :
ArrayList List = new ArrayList();
List.Add("AAA");
List.Add("AA");
List.Add("BB");
List.Add("BB");
if (List.Contains("AA")
comboBox1.Items.Add("AA");
Ram
|
|
|
|
|
If you you are using .net3.0 or higher you can use this:
List<string> list = new List<string>();
list.Add("AAA");
list.Add("AA");
list.Add("BB");
list.Add("BB");
foreach (string found in list.FindAll(x=> x=="AA"))
comboBox1.Items.Add(value);
The above code is one way if achieving what you want. The generic list (equivalent to a c++ template) has a few advantages, the list is strongly typed (in this case all elements are strings). Additionally the generic list has more methods allowing you to find stuff in the list over the old ArrayList . The only thing I'd say (and it's a drawback in the code snippet I've added) is that the predicate syntax looks a little weird if you aren't used to it: list.FindAll(x=> x=="AA")
See Generic List MSDN[^] for members of a generic lists if interested.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Not an answer to your question, but a suggestion.
An ArrayList is generally not recommended as every item has to be converted to/from a object . This boxing/unboxing is an unecessary performance hit and more importantly can make working with the items (and therefore the code) more complicated.
If the items are all of the same type then use List<T> (where T is the type of your object, so for the example you have given use List<string> . There are other collections in System.Collections.Generic and System.Collections.ObjectModel that you may find useful depending on what you are using the list for. I would recommend using the generic types where available or the ones that are type specific such as StringCollection .
If you have mixed classes that you want in a collection but they derive from a common base class or interface then you can have a collection of that eg: List<IMyBaseInterface> .
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hi Experts,
I am trying to use
ArrayList List = new ArrayList();
I am getting an error msg as
The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference?)
Even i tried,including the namespce :
using System.Collections.Generic
using System.collection
Still i am getting error.
Any idea what i must include
Thanks
Raj
|
|
|
|
|
raju_shiva wrote: using System.collection
This just might be a typo, but you should be using System.Collections ;
If this is right, then what version of the framework are using - remember Silverlight does not have an arrayList .
|
|
|
|
|
Hi sir,
As i am new to C#.I am comfused a bit to convert a code from VC++ to C#
which i did,
This is what i did in VC++
std::map<CString,CString>m_mapId;
m_mapId["AA"];
m_mapId["AAA"];
m_mapId["BB"];
m_mapId["BBB"];
CTest1View::OnEditchangeCombo1()
{
CString strvalue;
CString strTemp;
m_ctrlCombo.GetWindowText(strvalue);
std::map<CString,CString>::iterator it=m_mapId.begin();
m_ctrlCombo.ResetContent();
for(; it!=m_mapId.end();it++)
{
strTemp = it->first;
if(strTemp.Find(strvalue)==0)
m_ctrlCombo.AddString(strTemp);
}
m_ctrlCombo.SetWindowText(strvalue);
m_ctrlCombo.ShowDropDown();
}
I am trying it in C#
List<string> cities = new List<string>();
cities.Add("AAA");
cities.Add("AA");
cities.Add("BBBB");
cities.Add("BB");
comboBox1_KeyPress(object sender, KeyPressEventArgs e)
{
foreach (string A in cities)
{
MessageBox.Show(AA);
}
}
I am not getting how to loop till the end of list and find the character in the strings(one by one throughout the list)
and displaying them
Can anyone help me
Thanks
Raj
|
|
|
|
|
You might want to take a look at the Find method in a generic list.
|
|
|
|
|
Hi...,
Am in need to get the list of all page labels(numbers)..
In pdf Files the page (Labels)numbers be mentioned as
1. Roman letters(I,II,III.....)
2. Alphabets(A,BC,D,....)
3. Integers(1,2,3,4......)
And so on....
My input is a pdf file..
I have to read the page(Labels) numbers ... in a list or messageBox..
Am using the itextSharp libraries com
any url, help docs great helpful to me.
Regards,
Eswar
|
|
|
|
|
In my application I register a catch all unhandled exception handler with the following code:
AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException;
Strangely enough though sometimes, when the application is minimized and then restored, it crashes and show the standard Microsoft error reporting window:
"Application has encountered a problem and needs to be closed"
Why could that be? What can be done? Any ideas?
Notably this application is launched by a very simple launcher in a different AppDomain which does almost nothing, except starting a new app domain with file shadow copy = true.
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Since you have more than one AppDomain, you would also need more than one AppDomain.CurrentDomain.UnhandledException += someHandler; . And at most one of those could touch the GUI.
From all I've read one can come close to, but never achieve, a situation where all exceptions are caught. There are some very nasty ones when threads are being aborted.
This is what Daniel Grunwald posted on 07-AUG-2008:
The following event handlers seem to catch 97%* of the exceptions:
System.AppDomain.CurrentDomain.UnhandledException (catches all exceptions on secondary threads)
System.Windows.Forms.Application.ThreadException (catches exceptions on the Windows Forms thread)
System.Windows.Threading.Dispatcher.CurrentDispatcher.UnhandledException (catches exceptions in the WPF dispatcher)
try{}catch{} in void Main (catches exceptions on the Main thread that crash Windows Forms/WPF)
The missing 3% are fatal exceptions (e.g. stack overflow) and exceptions in Drag'n'Drop events (both in Windows.Forms and WPF) - those get silently swallowed if not caught in the event handler.
Note that I am able to handle AppDomain.UnhandledException fine without the compatibility setting. You still get the event in .NET 2.0, but the exception will cause the process to terminate after the event handler has run. But you can use the event to display a MessageBox/custom error dialog. You could even keep the app (sort of) going on by putting an infinite sleep at the end of the event handler.
|
|
|
|
|
Thanks Luc!
I will do some more test with the System.Windows.Threading.Dispatcher.CurrentDispatcher.UnhandledException, will see if it helps!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi all,
Could you please let me know which property of the chart object will allow me to format values in Currency?
I want to have my Y axis to show Currency Amonut Like ($100,$200,%300 etc...)
Here is my code..
How can i format the chart control so that the revenue apprears in £ sign?
At the moment its jUst showing Numbers not having a $ sign.
Here is Code:
With dt
.Columns.Add(New DataColumn("Hours", System.Type.GetType("System.String")))
.Columns.Add(New DataColumn("Revenue", System.Type.GetType("System.String")))
.PrimaryKey = New DataColumn() {dt.Columns("Hour")}
End With
Using con As SqlConnection = New SqlConnection(Session("ConnectionString").ToString)
Using com As SqlCommand = New SqlCommand(strCommand, con)
con.Open()
Dim i As Integer = 0
Using reader As SqlDataReader = com.ExecuteReader
While reader.Read()
' Dim sSeries As String = reader(0).ToString.Trim.
Dim sSeries As String = reader.GetName(i)
Dim dr As DataRow
Dim sData As String = ConvertToString(reader(0))
If sData = "Total" Then
Else
' For f As Integer = 1 To reader.
dr = dt.NewRow()
'dr("Hour") = reader.GetName(i)
Try
dr("Hours") = Convert.ToString(reader(0))
dr("Revenue") = Convert.ToDecimal(reader(1))
Catch ex As Exception
End Try
dt.Rows.Add(dr)
dt.AcceptChanges()
End If
End While
Dim Count As Integer = dt.Rows.Count
If Count = 0 Then
Exit Sub
End If
With Chart1
.Titles.Add("Revenue Generated by Hour and Channel ")
.Series.Clear()
.Series.Add("Revenue")
.ChartAreas.Clear()
.ChartAreas.Add("ChartArea1")
.ChartAreas("ChartArea1").AxisX.Title = "HOUR"
.ChartAreas("ChartArea1").AxisY.Title = "Revenue"
.Series("Revenue").ChartType = SeriesChartType.Column
.Series("Revenue").IsValueShownAsLabel = True
.DataSource = dt
.Series("Revenue").XValueMember = "Hours"
.Series("Revenue").AxisLabel = "Revenue"
.Series("Revenue").XAxisType = AxisType.Primary
.Series("Revenue").YValueMembers = "Revenue"
.DataBind()
.Legends.Add("Legend1")
.AlignDataPointsByAxisLabel()
End With
modified on Thursday, July 1, 2010 3:18 PM
|
|
|
|
|