Search the Community
Showing results for tags 'c sharp'.
-
Hi all, I am a newbie to C# programming hence do not know much about the language as of now. I need help if someone could tell me how to create a C# program which will keep fetching GPUs temp installed in my system and restart MSI Afterburner when any of the temps reaches 60 degree clecius. Help would be much appreciated!!
-
Does anyone have experience with using CScore in C# that could explain me how to get the modulus of all of the complex results from the FFT performed on the WasapiCapture input source? I can't find any useful documentation or reference on the web. Thanks in advance PS. (if your answer is "just google it" or "No clue" or "I have used this ... but not CScore" please refrain from answering)
-
hi guys i have to write a c sharp program that uses loops to write all the double digit numbers (full, natural ones nochalfs or thirds) can anyone help me please?
-
Im trying to stream a image from one computer to another and i have found this code on stack overflow and i cant figure out what "myImage" in this code refers to. Is it a path to the image that im going to stream? I have tried making a variable called myImage as a string but i got ToStream highlighted in red saying "string doesnt contain a definition Tostream". so i guess it isnt the path.if someone could help me figure out what it means it would be very helpful. Thank you. The code is below public static Stream ToStream(this Image image, ImageFormat format) { var stream = new System.IO.MemoryStream(); image.Save(stream, format); stream.Position = 0; return stream; } var stream = myImage.ToStream(ImageFormat.Gif);
- 4 replies
-
- programming
- streaming
-
(and 1 more)
Tagged with:
-
i am trying to display a text file which has a couple of words written in it using a message box . i have tried the code shown below but i ran in to a error saying: An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll Additional information: The user name or password is incorrect. I have set the permissions of this folder as full control to Everyone in advance sharing setting and im sure that the connection between the 2 computers have been correctly established as im able to ping the two computers. what i think the program get this error is because it doesnt have the username and password to get into the other computer. if i am correct then how do i put in the username and password in the code? i have done some searching but i havent found anything that works. im trying this in C# windows forms and if some one could help me i would really appreciate it. var data = File.ReadAllText(@"\\192.168.1.1\foldername\filename.txt"); MessageBox.Show(data);
-
i asked this question like a week ago,asking it again as i still havent managed to find a proper solution. im trying to stream video files between 2 computers where 1 acts as the server and contains the video files the other is the client that is accessing them remotely. i have been directed to this code shown in the site: http://csharpmagics.blogspot.com/2008/11/stream-video-over-lan-using-cnet.html and so i did try it but when i run it nothing happens. no errors or anything the 2 forms just stay open and nothing is shown. i did change the IP address to the loopback address (127.0.01) as at the moment im using a single PC to test if this is working and the site also says loop back address should work. i also did put a path in my computer with a mp4 video file. i dont see any other changes i should do to that code. i tried what i could by going through the code to spot any mistakes but i dont understand the code very well so i might be missing something. it would be very helpful if someone could help me figure out what the problem is. the method shown in the site is the only method i came across and there were comments that it works.if u know any other better way please do comment below but in a simple way as i am not very good at programming. thanks
-
Original post is on another site but please answer here, there aren`t notifications on that site. Original post: http://forum.brackeys.com/thread/error-in-code-please-help/#reply_52869 Images : https://ibb.co/cmy3Cbhttps://ibb.co/hMXKkw
-
Hello, So what is the ASP web stuff used for and how does it work? So I have a form with buttons, is there a way how I could also make it available on etc that default localhost:8080 with the same buttons? etc I have a enable button that does something, could I have the same thing in the web? I have no idea what it is I just noticed that there was something like that for winform, and that I could use it if it worked like I explained.
-
I need a code that changes the color of all of my game objects (not sprites), but not all to the same color (each object must have a random color). I made a code that asigns the same random color to all of the game objects(not sprites). And i cannot figure this out, i am struggling with this for several hours now, really annoying! Heres the code: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class RandomizeColors : MonoBehaviour { Vector4[] colors = { new Vector4(1, 0, 0, 1), new Vector4(0, 1, 0, 1), new Vector4(0, 0, 1, 1), new Vector4(0, 1, 1, 1), new Vector4(1, 0, 1, 1), new Vector4(1, 1, 0, 1) }; private Vector4 RandomColor() { Vector4 color = colors[Random.Range(0, colors.Length)]; return color; } private void Update() { GetComponent<Image>().material.color = RandomColor(); } }
-
Simple question I am reading a line from a text file which contains \n's and when I print the string it doesn't print the \n as a new line but as "\n" how do I change this into a newline. Line 1 is what I get, Lines 2-5 is what I want. (I did this manually to get the desired output) EDIT: Just found out why it's doing it, it is turning /n into //n so I need to find //n and replace it with /n, any suggestions on how to do this
- 2 replies
-
- c
- visual stuido
-
(and 1 more)
Tagged with:
-
Hi, I am new to c#, I am trying to code a page where select a button it will pass the image and its text to the other page, however, it shows me this error. (I was having an error with the code in bold and underlined ) An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll Parameter is not valid. (The first code was the image and message to be inserted) (The second code was for the image and message to be inserted into the first code) First code public Booking(Image passingimage, string bandtitle) { InitializeComponent(); pictureBox1.Image = passingimage; bunifuCustomLabel5.Text = bandtitle; } public static void Shbooking(string bandtitle, Image passingimage) { Booking bk = new SoftwarePrj_LawZhiMing.Booking (passingimage,bandtitle); bk.ShowDialog(); } Second Code public partial class EandB : UserControl { Image passingimage; public static string passingtitle; private void BunifuThinButton21_Click_1(object sender, EventArgs e) { ((Home)this.TopLevelControl).Hide(); passingimage = pictureBox6.Image; passingtitle = bunifuCustomLabel2.Text; Booking.Shbooking(passingtitle, passingimage); } }
-
- c sharp
- showdialog
- (and 4 more)
-
So i have begin coding for two years now. And I think I haven't really learnt anything for about 18 months. Does anyone know any good courses or sites to use as I find it a useful skill and also quite fun to do. I primarly do python but want to expand out to other languages.
-
I'm working with an API that has a weird way of doing arrays which I just can't understand how to convert to a C# array/list. Note: I'm using Newtonsoft.Json The JSON "array" looks something like this: Values : { "0": { "some data" }, "1": { "more data" }, "2": { "even more data" } } The thing is that the array itself isn't actually an array, its an object containing objects which have their name as array index and value their data... I don't get why the API was made this way, how you would handle this even in JavaScript For smaller arrays like this I did something like this, using JsonProperty in a way that I know: class Data { public string Value { get; set; } } [JsonProperty("0")] public Data Zero { get; set; } [JsonProperty("1")] public Data One { get; set; } [JsonProperty("2")] public Data Two { get; set; } public Data[] All { get { return new Data[] { Zero, One, Two } } } It works... kind of a hacky way of doing it, but some arrays are up to couple of thousand elements big and I have no clue if they are fixed or can expand in the future so this way of doing it is not practical at all. I have no control over the API, I can just fetch that data I have tried searching around if maybe there is a wildcard for the JsonPropertyAttribute name so that it can handle this kind of stuff but haven't found anything helpful or anyone else working with JSON of this type. Has anyone worked with something like this before and/or has an idea of how to handle this? Thank you in advance!
-
Goal: to login to the website and download it's source. Web page i want to send a login request to: https://www.workis.online/#!/home Since it does not use a standard form login i cannot just fill my 'username' and 'password' and click a login button using C# web browser. I have seen examples of people using POST method to send their data to the server but not when authentication is performed with an API. (Keep in mind that I'm fairly new to this)What I've figured out so far is that the website pre-loads (if one exists) facebook and google cookies. And i assume that those cookies are sent to the server (somehow). Problem: what is sent to the server when either one of the options (facebook or google) is used and how can I emulate that?
-
Hey guys, I've been working on this project and I'm trying to spawn the enemies in random positions but they all spawn together in a random position, how would I make each individual enemy spawn in a random position. public GameObject Enemy; public TextMesh text; private int i = 0; void Start () { text.text = "Round 1"; } // Update is called once per frame void Update () { Vector2 RandPos = new Vector2 (Random.Range(-15f, 15f), 0f); while (i < 5) { Instantiate (Enemy, RandPos, transform.rotation); i++; } In the code the instantiation spawns an enemy prefab 5 times in the random position between -15 and +15 on the x axis, but all 5 enemies spawn together and i want them to spawn in individual positions. any help will be appreciated
-
hey guys I'm creating an infinite 'Flappy bird' like game, when both objects are instantiated it gets given a random range, to add some RNG into the game but i want to add a consistent fixed distance between the 2 platforms and I'm not sure how to do it, I've tried lots of different things like using vector2.distance and changing the position of the object to a specific distance but i cant seem to get it to work, here's my code. public class Spawner : MonoBehaviour { public GameObject Platform1; public GameObject Platform2; public float CoolDown = 3f; public float CoolDownTimer; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (CoolDownTimer > 0) { CoolDownTimer -= Time.deltaTime; } if (CoolDownTimer < 0) { CoolDownTimer = 0; } if (CoolDownTimer == 0) { Vector2 RandRange = new Vector2 (10f, Random.Range(2f, 6f)); Instantiate (Platform1, RandRange, transform.rotation); Vector2 RandRange2 = new Vector2 (10f, Random.Range(-2f, -6f)); Instantiate (Platform2, RandRange2, transform.rotation); CoolDownTimer = CoolDown; } } } any help will be appreciated, thanks .
- 1 reply
-
- c sharp
- programming
-
(and 1 more)
Tagged with:
-
hey guys I'm just creating an 8 ball application and when i debug i get a warning saying the process cannot access the file because it is being used by another process and the file is locked by: (as seen in the image below) I have no idea why I'm getting this problem, any help will be appreciated, thanks .
-
So basically want I'm trying to do is send a command to the PC through my phone. If i click a button i want it at this time to lock the PC. This works when on PC but I'm not sure how to send a signal via bluetooth Does anyone have a guide to where to find this, or a solution? Would be much appreciated
-
namespace Project_6 { class Program { //Name: Adam Rubin //Date Created: 4/9/2018 //Purpose: To create a program that helps the user figure out if they can hire teachers. static void Main(string[] args) { //Declare arrays: //Minimum Salary Array: decimal[] minimumSalary = new decimal[] { 31600M, 31975M, 32350M, 32725M, 33100M, 33500M, 33900M }; //Years of Experience Array (Entry) int[] yearsOfExperience = new int[6]; //Request user input for 6 teachers, and their years of experience for (int i = 0; i < yearsOfExperience.Length; i++) { Console.WriteLine("Enter the years of Experience: "); yearsOfExperience[i] = int.Parse(Console.ReadLine()); } //console.readkey to keep everything on the screen Console.ReadKey(); }//end of main private static decimal CalculateTotalSalaries(decimal[] decimalArray, decimal[] decimalArray2) { decimal totalSalary = 0; for (int i = 0; i < decimalArray.Length; i++) { totalSalary = totalSalary + decimalArray[i]; } return totalSalary; } } } Hey everyone, hit a roadblock. I've basically got to take two arrays, one with total years of experience that the user enters, and one that has the minimum salary. Basically what needs to happen in the method CalculateTotalSalaries is for the total of salaries per years of what the user entered. i.e. what would happen is that when the user enters: 1 1 5 3 6 2 the method would add together 31975 31975 33500 32725 33900 32350 and spit out the return value as: 196425 for total salary
-
hey guys, I'm looking for some sort of method like update() from unity but in c#, visual studio, as that would work with what i need to do. is there a method like this in c# ? thanks
-
I will be running some programming videos on my channel all summer. If anyone have any special request to let me know. The link is below along with what I have done so far.
-
Hey! I'm dynamicly creating listboxes in my program and i want to do something with them in another method but it gives me the NullReferenceException exception. What should i do? public void newTabButton_Click(object sender, EventArgs e) { TextBox textBoxJan = new TextBox(); textBoxJan.KeyDown += new KeyEventHandler(textBoxJan_KeyDown); ListBox LBJan = new ListBox(); tabControl1.TabPages.Add(tabPage); tabPage.Controls.Add(LBJan); tabPage.Controls.Add(textBoxJan); } public ListBox LBJan; public Label sumLabel; public void textBoxJan_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (sender is TextBox) { TextBox textBoxJan = (TextBox)sender; LBJan.Items.Add(textBoxJan.Text) } } }
-
I'm currently making a SMS Bomber in C# would It be smart to put something like "I'm not responsible if you break any laws.etc while you are using this program?" Just don't to get in trouble.etc Thanks, Ausitn
-
G'day techies, I'm working on a checksum application and i added a drag&drop function, this all worked fine up untill i requested the application to be elevated. At this point drag&drop stopped working, this is because of windows message system blablabla, long story short: you can't drop&drop to a higher elevated application only to equal or lower ones. I've tried it within the app.manifest <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> and then changing uiAccess to true, but this can only be done when the program is installed in program files, or by some sort of certificate. So could someone help me out here? It can be 2 things: or i have to request admin privileges for just 1 function and then remove them somehow, i have already tried this with PrincipalPermission only this gave me an error that it failed. or i need to be able to enable uiAccess Link to the project: https://github.com/victorheld/checksum Sincerely, Onno
-
so i have been searching for this in the internet and i have seen many people recommending to use IDs of hardware such as processors and HDD's ID. they have also recommended to use multiple ID's from different hardware because the chances that two or more people could have the exact same hardware are pretty less. if i decide to use processor ID and HDD ID to identify a computer uniquely and give them a key is it a good idea? and what happens if by any chance a person does have the same Processor and HDD as another registered user. any idea how to handle such problems?
- 2 replies
-
- licencing
- programming
-
(and 2 more)
Tagged with: