|
thanks see im sorry il edit my question and fix it now , i want an installer
|
|
|
|
|
Unless you want to write one yourself, I suggest you follow the links given and see if any of those installers would be appropriate for your application
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How to Display the Image in Form2 and the Image selected in listbox of Form1 ?
EXample:
Form1 have listbox(15 images).
Form2 - Display the image in form2.when i click show button in form1
|
|
|
|
|
|
Hello
You need to follow these steps:
Create an Instance of form2 on form1 button click event
Form2 frm = new Form2();
frm.BackgroundImage = Image.FromFile(ListBox1.SelectedItem.ToString());
In that code i assumed that path of images are listed in listbox
Thanks
-------
web designing in Agra
|
|
|
|
|
Watch who you're replying to. Griff already knows how to do this.
Oh, and your solution locks the image file for the lifetime of the Image object you get back from the call to Image.FromFile .
It's better you use a file stream to load the data into a Bitmap and dispose the stream, avoiding the lock on the image file.
|
|
|
|
|
add click/doubleclick event to your listbox control and pass the current image name to second page using constructor or property. in your second page you can load the image from the image name.
|
|
|
|
|
i am proofreading my prof program and creating classes changing the dictionary of it can u help me solve this? i am new to c# ..sorry to ask a stupid question...
Code:
foreach (KeyValuePair<string, object=""> kvp in dict)
{
log.WriteErrorToLog(kvp.Key + "=" + Iif(kvp.Value == null, "null", kvp.Value.ToString()), "AddOrder_DEBUG_LOG");
}
how to solve this?
modified 12-Aug-15 0:56am.
|
|
|
|
|
You didn't post the error, but are you missing a closing parenthesis. Should
Convert.ToInt32(dict.PreAuthResultCode.ToString(),
be
Convert.ToInt32(dict.PreAuthResultCode.ToString()),
As a side note, why the unnecessary ToString calls? For example
"CardPreAuthorizationNumber".ToString()
The constant string is already a string...
|
|
|
|
|
@ mika hi the error is the foreach says here it cannot operate i wonder why?
|
|
|
|
|
Ok, now you have posted a different code fragment.
But in the
foreach (KeyValuePair kvp in dict)
what is the definitions for dict and from what namespace the KeyValuePair comes from?
If it is a generic dictionary, then the keyvaluepair should also have the type arguments defined.
|
|
|
|
|
you made me realize..wait ill check ...
|
|
|
|
|
namespace System.Collections.Generic
{
[Serializable]
public struct KeyValuePair<tkey, tvalue="">
{
public KeyValuePair(TKey key, TValue value);
public TKey Key { get; }
public TValue Value { get; }
public override string ToString();
}
}
and the dict? dont know every strand of this but i think all dict(dictionaries have been moved to a class. thats my task
|
|
|
|
|
I'm not sure if I follow but if you operate on native objects then the following code should be just fine
System.Collections.Generic.Dictionary<int, string> dict = new Dictionary<int, string>();
dict.Add(1, "A");
dict.Add(2, "B");
foreach (System.Collections.Generic.KeyValuePair<int, string> item in dict) {
System.Diagnostics.Debug.WriteLine(string.Format("Key: {0}, value {1}", item.Key, item.Value));
}
Then again if you have created your own classes, then you should post all the relevant code, meaning definitions and usage in order to see the whole situation.
|
|
|
|
|
okay thanks that worked ur sooo good then last question is it okay?
error: 'dict' is a variable but is used like a mehtod.
error goes here ==> dict(paymentType + "CardPreAuthorizationNumber") = AuthCode;
|
|
|
|
|
Sphinxniuie wrote: error: 'dict' is a variable but is used like a mehtod.
error goes here ==> dict(paymentType + "CardPreAuthorizationNumber") = AuthCode;
Again this depends on the definition of the dict but if it is a generic dictionary, then use brackets [] to define the index instead of parenthesis () which are used to separate parameters for a method. Note that dictionary needs two values, the key as an index and the value as explained in Dictionary<TKey, TValue> Class[^]
|
|
|
|
|
ahh i see thanks again mika its a grEEEEAAAAAAt help for me
|
|
|
|
|
but thanks anyway u saved me from that
|
|
|
|
|
hi im using vs2015 so i tried getting WIX for creating installers , the problem is that when i try 2 install WIX v3.10 (latest) i get an error but WIX 3.9 installed perfectly but somehow its not being recognized in VS
|
|
|
|
|
jamesmc1535 wrote: its not being recognized in VS
Is WIX supposed to be integrated with Visual Studio? I thought it was a standalone package.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
it is a standalone but it integrates with vs /
|
|
|
|
|
I'm posting this here because I believe this to be a threading issue, not a DB issue. FYI, I'm using SQLite with dotConnect and EF.
I'm calling a DAL function from two different places on start of my app. Basically there are two lists both being populated from a DAL call. Both places use Background workers to make the same call:
private void loadWorker_DoWork(object sender, DoWorkEventArgs e)
{
var sensors = AppCore.AppDAL.GetSensors();
e.Result = sensors;
}
Then in the DAL I have a call to get the sensors:
public List<SensorEntity> GetSensors()
{
lock (lockObj)
{
var query = getSensorQuery();
var results = query.OrderBy(x => x.SensorName).ToList();
<pre>
results.ForEach(x => x.Category = GetSensorCategory(x.SensorTypeID));
return results;
}
}
private IQueryable<sensorentity> getSensorQuery()
{
var results = (from s in dataContext.Sensors
select new SensorEntity
{
ID = s.ID,
SensorTypeID = s.SensorTypeID,
SensorName = s.Name,
Description = s.Description,
Address = s.SourceAddress.Value,
LastActivityDT = s.LastUpdate
});
return results;
}
Then for each sensor I get it's Category
public SensorCategoryEntity GetSensorCategory(long ID)
{
var query = getSensorCategoryQuery();
var results = query.Where(x => x.ID == ID).FirstOrDefault();
return results;
}
private IQueryable<SensorCategoryEntity> getSensorCategoryQuery()
{
var query = (from sc in dataContext.SensorTypes
select new SensorCategoryEntity
{
ID = sc.ID,
Name = sc.Name
});
return query;
}
At the point indicated I get
"Object cannot be cast from DBNull to other types."
If I put in a Thread.Sleep, like below, then it works fine. if I block out the second call, it works fine.
private void loadWorker_DoWork(object sender, DoWorkEventArgs e)
{
Thread.Sleep(500);
var sensors = Falcon6Core.Falcon6DAL.GetSensors();
e.Result = sensors;
}
I don't really understand what's going on here. I'm not inserting data... it's just a simple query.. Why would there be any kind of threading problem here?
If it's not broken, fix it until it is
|
|
|
|
|
|
Not really.
Right at the top is says
"Serialized. In serialized mode, SQLite can be safely used by multiple threads with no restriction"
and
"The default mode is serialized."
I haven't changed the threading mode, so it should be default.
If it's not broken, fix it until it is
|
|
|
|
|
dbContext is not thread safe.
Based on the few code fragments you've posted, it looks like you're sharing dbContext between your threads. Assuming your "lock" is even a solution, I think it is in the wrong place and should have been put in the top of the loadWorker_DoWork() method.
(I would have given each thread their own dbContext).
|
|
|
|