|
Thanks at all you guys!
How can i protect my password for connection to the Microsoft Access Database?
Can i use Store Procedure with Access Database?
|
|
|
|
|
Hi,
How can i use variables as an old value an dnew value in String variable's Replace method like Replace(var1, var2). I tried it but it is not working.
p
|
|
|
|
|
sohne wrote: How can i use variables as an old value an dnew value in String variable's Replace method like Replace(var1, var2).
Like this:
string originalString = "I like cats.";
string oldValue = "cats";
string newValue = "dogs";
string newString = originalString.Replace(oldValue, newValue);
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hello!
I would like to import conactinformation to Microsoft Outlook C#. I know how to do this if you want the information to be put into your regular contactlist in Microsoft Outlook. But I can't get it to be a part of "Public Folders -> All Public Folders". Here is my code:
<br />
public void exportContactToOutlook(Person contact)<br />
{<br />
Outlook.Application objOutlook = new Outlook.ApplicationClass();<br />
NameSpace outlookNS = objOutlook.GetNamespace("MAPI");<br />
MAPIFolder contactFolder = outlookNS.GetDefaultFolder(OlDefaultFolders.olPublicFoldersAllPublicFolders);<br />
<br />
<br />
Outlook.ContactItem objContact = (Outlook.ContactItem)objOutlook.CreateItem(Outlook.OlItemType.olContactItem); <br />
objContact.CompanyName = contact.CompanyName;<br />
objContact.Save();<br />
}<br />
This will only save it to the regular contactlist. I know that this code shouldn't work but what is the missing link? Any ideas?
|
|
|
|
|
How can be a transparent panel control can be created. As I tried in many ways but it is applicable to window but not to the required control (panel), as well as I also have observed that Transparency will be applicable to windows forms but not to user control. Is it so, if yes why.
Shashidhar
|
|
|
|
|
i have tried a lot but did not find any method for that
i think it's impossible
Regards,
Pramod
|
|
|
|
|
Try making a bitmap that is all one colour and setting it as the background image for your panel.
Then add the following code to the form_Load event
Bitmap bitmap = (Bitmap)pnlBackground.BackgroundImage;
bitmap.MakeTransparent(bitmap.GetPixel(1, 1));
TransparencyKey = BackColor;
You may also need to start the form minimized and then do WindowState = FormWindowState.Normal; I don't know why but sometimes this is the case.
Cheers
Kev
|
|
|
|
|
Hello,
can anyone show me a sample how to establish a GPRS connection in c# .net?
Or tell me where to look.
thanks
|
|
|
|
|
Hi,
How to start and stop windows services using c# asp.net.
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
You can use the System.ServiceProcess.ServiceController class, from the System.ServiceProcess.dll assembly.
Bear in mind that you generally need administrative privileges to stop or start a service, which your ASP.NET code will not normally have. You'll typically have to change the user that the code runs under. On Windows 2000 or Windows XP, you configure this with the <processModel> element in the Machine.config file, and it affects all ASP.NET applications on the server; on Windows Server 2003 you configure it through the Internet Information Services administration console, all applications in the same application pool share the same worker process.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I am reading a file into a listBox as follows:
***********************************
StreamReader SR;
FileStream FS = File.Open("c:\\wsIder\\info.ini", FileMode.Open, FileAccess.Read);
SR = new StreamReader(FS);
string line;
while((line = SR.ReadLine()) != null)
{
viewS.Items.Add(line);
}
SR.Close();
******************************
the file contains section separated with bracket like this
[SEC1]
...some text
[SEC2]
...some text
etc
When I display the file in the listbox, I would like to use colored text for the sections. [SEC1]=red, {sec2]=green..etc
Any idea how to do this?
|
|
|
|
|
With the standard listbox control, you cannot do that. You need a owner drawn listbox. See this article: this is probably what you need:
http://www.codeproject.com/cs/combobox/colorlistbox.asp[^]
Once you have implemented the listbox as described in the article, you just have to do some parsing of the text you read from the file, like if the line starts with a '[' then change that item's color to red... etc etc
Koushik Biswas
|
|
|
|
|
Hi
i am working in c# with infragistics
In c# windows applicaion, I will be passing data from textbox..such that
for example:i ahev 3 texboxes labeled
name:
age:
salary:....
Now name is the parent and age and salary r the child..so if i pass data in
the appropriate textbox..It should be added in the [B]ultrawintree..[/B]such that
name(parent) should show up on the root node of the tree. and age and
salary(child) should show up under the root node.
as I am new to infragistics , I am learning. Please help me with
coding..and please explain me ...
dhol
|
|
|
|
|
What is infragistics, a class library ? You need to ask them.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
I have 2 classes and I want when the second class raises an event, the first class can catch and do something.
I have heard about using delegate to do this, but I dont know how to do?
Hung
|
|
|
|
|
This[^] is where you should begin. The documentation actually explains things pretty well.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I am having an issue with ConfigurationSettings.AppSettings in a multi-threaded winforms application. I have an error thrown by the .net framework Config class when both the main thread and worker thread access the AppSettings namevalue collection. Is this a threadsafe issue? I have tried using lock for the AppSettings collection, but this throws the same error. Below is the code to reproduce the error:
private void Form1_Load(object sender, System.EventArgs e)
{
MethodInvoker myInvoker = new MethodInvoker(WorkerThreadFunction);
myInvoker.BeginInvoke(new AsyncCallback(WorkerThreadAsyncCallBack), myInvoker);
NameValueCollection nvc = ConfigurationSettings.AppSettings;
}
private void WorkerThreadFunction()
{
string settingVal = ConfigurationSettings.AppSettings["Setting1"];
}
The following error results:
"Object reference not set to an instance of an object"
Stack Trace:
at System.Configuration.ConfigurationRecord.Evaluate(String configKey)
at System.Configuration.ConfigurationRecord.ResolveConfig(String configKey)
at System.Configuration.ConfigurationRecord.GetConfig(String configKey)
at System.Configuration.DefaultConfigurationSystem.System.Configuration.IConfigurationSystem.GetConfig(String configKey)
at System.Configuration.ConfigurationSettings.GetConfig(String sectionName)
at System.Configuration.ConfigurationSettings.get_AppSettings()
Can anyone shed some light on this issue?
Thanks in advance...
|
|
|
|
|
I want to define a Row as an object:
if my database is:
[Text][Text][OLE OBJECT]
i want to create an row object in my c#application with that structure.
Insert value inside the put in some way in the original Database.
Is it possible with ADO.NET?
|
|
|
|
|
You could write a bunch of code to do that, but ADO.NET does not work that way by itself. It's designed to be disconnected, so you'd need to write all the code to keep connecting and updating values when you set them.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
so are you telling me is it not possible?
Another thing:
If i've to add some Field into a table with the INSERT query, but i have to leave empty someother what is the correct query:
INSER into table mytab ([Name], [Surname], [EYESCOLOR], [IMAGE]) Value ('Mike', 'Tyson', 'Null', 'Null')
or
INSER into table mytab ([Name], [Surname], [EYESCOLOR], [IMAGE]) Value ('Mike', 'Tyson', '', Null)
INSER into table mytab ([Name], [Surname], [EYESCOLOR], [IMAGE]) Value ('Mike', 'Tyson', 'NULL', NULL)
????
|
|
|
|
|
Sasuko wrote: so are you telling me is it not possible?
Not without writing the code, no.
Neither. It's DBNull.Value, I believe.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am trying to read image ( binary data type) directly from database. I can read if the image is single ,but if there are multiple images put together( inside one column) , I am not be able to read it. Can you take a look at below code and let me know what I am doing wrong?
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Data.SqlClient;
using System.IO;
using System.Drawing.Imaging;
using System.Collections.Generic;
public partial class GetImage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
const int oleOffset = 78;
const int oleTypeStart = 20;
const int oleTypeLength = 12;
string TransactionId;
string sql;
Bitmap bmp;
byte[] imageBytes;
TransactionId = (string)this.Request.QueryString["TransactionId"];
if (TransactionId == null) return;
TransactionId = int.Parse(TransactionId).ToString();
sql = "Select Image from Image where TransactionId=" + TransactionId;
ConnectionStringSettings cnSetting =
ConfigurationManager.ConnectionStrings["AppConnectionString6"];
using (SqlConnection cn = new SqlConnection(cnSetting.ConnectionString))
{
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
dr.Read();
imageBytes = (byte[])dr.GetValue(0);
}
}
}
if (imageBytes == null || imageBytes.Length == 0) return;
MemoryStream tempStream;
string type = System.Text.Encoding.ASCII.GetString(
imageBytes, oleTypeStart, oleTypeLength);
if (type == "Bitmap Image")
{
tempStream = new MemoryStream(
imageBytes, oleOffset, imageBytes.Length - oleOffset);
}
else
{
tempStream = new MemoryStream(
imageBytes, 0, imageBytes.Length);
}
bmp = new Bitmap(tempStream);
// bmp = new Bitmap(bmp, bmp.Height / 3 , bmp.Width / 2);
Response.ContentType = "Image/gif";
bmp.Save(Response.OutputStream, ImageFormat.Gif);
Response.End();
}
private void _GetMultipleImages ()
{
const int oleOffset = 78;
const int oleTypeStart = 20;
const int oleTypeLength = 12;
string TransactionId;
string sql;
byte[] imageBytes;
TransactionId = (string)this.Request.QueryString["TransactionId"];
if (TransactionId == null) return;
TransactionId = int.Parse(TransactionId).ToString();
sql = "Select Image from Image where TransactionId=" + TransactionId;
ConnectionStringSettings cnSetting =
ConfigurationManager.ConnectionStrings["AppConnectionString6"];
using (SqlConnection cn = new SqlConnection(cnSetting.ConnectionString))
{
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
dr.Read();
imageBytes = (byte[])dr["Image"];
}
}
}
if (imageBytes == null || imageBytes.Length == 0) return;
ArrayList imgList = new ArrayList();
using (SqlConnection cn = new SqlConnection(cnSetting.ConnectionString))
{
sql = "select FrontImageOffset, FrontImageSize from CDData where TransactionId=" + TransactionId;
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
if (dr.HasRows)
{
if (dr.Read())
{
//
// Make a static copy of the buffer information
//
long imagebytesLen = imageBytes.Length;
List<byte> imgBytes = new List<byte>(imageBytes);
do
{
long offset = (long)dr["FrontImageOffset"];
long length = (long)dr["FrontImageSize"];
//
// Determine if we have enough buffer to read the bytes
//
if (imagebytesLen >= (offset + length))
{
//
// allocate a new buffer for our image and then
// make a copy of it from our image buffer.
//
byte[] newimage = new byte[length];
imgBytes.CopyTo(Convert.ToInt32 (offset), newimage, 0, newimage.Length);
//
// Now add us to our list
//
imgList.Add(newimage);
}
} while (dr.NextResult());
}
}
dr.Close();
}
}
}
//
// Do we have any images?
//
if (imgList.Count > 0)
{
//
// Loop through the list and concatenate all the images
// into one huge image.
//
List<byte> bigImage = new List<byte>();
for (int i = 0; i < imgList.Count; ++i)
{
bigImage.AddRange((byte[])imgList[i]);
}
//
// Create hte bitmap from the buffered data
//
byte[] data = bigImage.ToArray();
MemoryStream tempStream = new MemoryStream(imageBytes);
tempStream.Position = 0;
System.Drawing.Image bmp = System.Drawing.Image.FromStream(tempStream);
// bmp = new Bitmap(bmp, bmp.Height / 3 , bmp.Width / 2);
Response.ContentType = "Image/gif";
bmp.Save(Response.OutputStream, ImageFormat.Gif);
Response.End();
}
}
}
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
I am getting an error when try to debug:
System.ArgumentOutOfRangeException was unhandled by user code
Message="Index and count must refer to a location within the buffer.\r\nParameter name: bytes"
Source="mscorlib"
ParamName="bytes"
StackTrace:
at System.Text.ASCIIEncoding.GetString(Byte[] bytes, Int32 byteIndex, Int32 byteCount)
at GetImage.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\jc\My Documents\Visual Studio 2005\WebSites\CashApp\Cash\GetImage.aspx.cs:line 50
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
|
|
|
|